Sponsored
Use these hints if you're stuck. Try solving on your own first.
Count the frequency of each value.
Use a custom comparator to compare values by their frequency. If two values have the same frequency, compare their values.
Solve with full IDE support and test cases