Please answer this

Is it necessary to solve this question using heap,i have solved it using hashmap?If not then which is of better TC?

Hey @garganshul151
No its not necessary to solve it using PQ.
Share your code in CodingBlocks Ide so that I can tell u which is better in terms of TC

i have solved it using O(nk)…is it fine

Hey @garganshul151
Yup its fine ,And better than soln with PQ :slight_smile:

see this one please is it fine

@garganshul151
Is it not working ?