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.
Make an additional HashMap to count per frecuencies because HashMap.containsValue() takes 0(n) time, it is too slow for this.
Modify the main function, don't insert the input in int[][] queries, remove that 2D array and rather work while reading.
Don't return a List with the results. Append the results to a StringBuilder and print it at the end
Only after doing those 3 things i could pass all tests. Here is my solution, i didn't use clean code because i was tired of this problem already so i was coding like "whatever". I think the problem editor should modify the main function as mine.
Frequency Queries
You are viewing a single comment's thread. Return to all comments →
For Java coders:
Only after doing those 3 things i could pass all tests. Here is my solution, i didn't use clean code because i was tired of this problem already so i was coding like "whatever". I think the problem editor should modify the main function as mine.