I've gotten the question in ML eng interviews 3 times: implement sparse vector and the respective dot product op. I always go for the handy DOK method.
If you know how it's supposed to work in theory but struggle to bang it out, you could do eg leetcode.