>_
top_k_frequent.java
Java 25.0
Not run yet

+ 7 hidden

Input
nums = [4, 4, 7, 2, 7, 4, 9, 7, 4]
k = 2
Expected
[4, 7]

4 appears four times and 7 three times; 2 and 9 appear once each, so they are left out.