[in reference to 347. Top K Frequent Elements]
I gave a custom test case of:
And the expected answer is "[1,2,4]". My understanding of the problem, and my code's result is "[1,2,3,4]".
This actually doesn't make sense. Shouldn't it then be [2,3,4]? It's not at all clear why the 3 is dropped. In the first case, I could accept that the most frequent elements are all accepted, and then the greatest of the next most frequent, until there are no more slots remaining. But in the second case, the accepted answer is plain nonsensical.
In any case, even if my understanding of why the 3 was dropped in the first case is correct, the problem constraints are incomplete. But that still doesn't address why the 3 was dropped in the second case.
Anyone with any insights?