We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all 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.