Given an integer array nums and an integer k, return the k most frequent values, ordered by frequency (highest first); break frequency ties by smaller value first.
Input
numskOutput: the k values, space-separated.
1 1 1 2 2 3 2
1 2
4 4 7 7 2
4 7
Tie on frequency — smaller value first.
Run your code against the sample tests, or Submit to run the full suite.