• + 0 comments

    Agreed. I don't see what this problem has to do with sparse arrays either. I implemented to simplest solution using an array and iterating thorugh it to get the counts (since it is in the array problem section), but obviously there are other solutions that are much more efficient such as leveraging a hash table/map, or even a trie if you want to save space. Eitherway, not a very challenging problem.