Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Put all the numbers in a hash map (or just an integer array given the number range is small) to maintain each number’s frequency dynamically.
Put each frequency in another hash map (or just an integer array given the range is small, note there are only 200000 calls in total) to maintain each kind of frequency dynamically.
Solve with full IDE support and test cases
Keep the 2 hash maps in sync.