Given an integer array nums and an integer k, return the k most frequent elements.
Output ordering (required): return the k elements sorted in ascending order so the result is unambiguous. The test inputs guarantee the set of top-k elements is unique (no frequency tie spans the cutoff).
[1,1,1,2,2,3], 2[4,4,5,5,5,1], 1[7], 1[1,2,3,4,5], 5[-1,-1,-2,-2,-2,3], 2[5,5,4,4,4,3,3,3,3,2], 3[10,10,10,9,9,8], 2