#3852
Smallest Pair With Different Frequencies
pupil · 305 · lc easy +21 · 69.2% accepted · 25 likes · top 77%
Description
Given an integer array nums, find all pairs of distinct values x < y whose frequencies in nums differ. Among all valid pairs, select the one with the smallest x (breaking ties by taking the smallest y). Return [x, y], or [-1, -1] if no valid pair exists.
Code
1
2
3