0

I am working on an interview question where I need to return the k most frequent elements given a non-empty array of integers.
Input: nums = [1,1,1,2,2,3], k = 2
Output: [1,2]
Here is my code:
public static void main(String[] args) {
System.out.println(topKFrequent(new int[] {1, 1, 1, 2,...