Given an integer array, sort it by increasing frequency of each value, and if two values have the same frequency, sort them in decreasing numerical order. This is a classic frequency-aware comparator problem.
nums = array of integers
array sorted by increasing frequency
Example 1:
Input:
nums = [1,1,2,2,2,3]
Output:
[3,1,1,2,2,2]
Explanation:
3 appears once, 1 appears twice, and 2 appears three times.
Example 2:
Input:
nums = [2,3,1,3,2]
Output:
[1,3,3,2,2]
Explanation:
Tie-breaking uses the larger value first when frequencies are equal.