whats wrong with this code?
Why its not getting accepted?
@Ishita,Does order matters in such kind of questions?,You can verify the same question with the exact same code get accepted on leetcode. https://leetcode.com/problems/top-k-frequent-elements/submissions/
@darkshadow2708 hackerblocks does not have the feature yet, to accept the answer in any order so to get AC here you’d have to take care of the order. Many websites like leetcode do offer that feature, so it is not mandatory there.
@darkshadow2708 if that does not work, you may also try using an ordered map, so that the original order of the elements would stay intact.