3852. Smallest Pair With Different Frequencies
You are given an integer array
nums.Consider all pairs of distinct values
xandyfromnumssuch that:
x < yxandyhave different frequencies innums.Among all such pairs:
- Choose the pair with the smallest possible value of
x.- If multiple pairs have the same
x, choose the one with the smallest possible value ofy.Return an integer array
[x, y]. If no valid pair exists, return[-1, -1].
1 | class Solution { |