4 ms·
Question is if you allow using prebuilt Map type data structures. Then it is easy just bucket count with keys being integers in the list and iterate afterwards
by sireat 5y ago
Question is if you allow using prebuilt Map type data structures.
Then it is easy just bucket count with keys being integers in the list and iterate afterwards filtering for value >= 2
Now if no Maps are allowed it is a bit trickier... you might need your own hashing function or as someone else suggested write your own nlogn sort..