Tap here to switch tabs
Problem
Submissions

Problem: Smallest Pair With Different Frequencies

med
30 min
Try to solve the Smallest Pair With Different Frequencies problem.

Statement

Given an integer array nums, let xx be the smallest distinct value present in nums.

Find the smallest distinct value yy in nums such that y>xy > x and the frequency of occurrence of yy in nums is not equal to the frequency of occurrence of xx in nums.

Return an array containing [x,y][x, y]. If no such value yy exists, return [−1,−1][-1, -1].

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Pair With Different Frequencies

med
30 min
Try to solve the Smallest Pair With Different Frequencies problem.

Statement

Given an integer array nums, let xx be the smallest distinct value present in nums.

Find the smallest distinct value yy in nums such that y>xy > x and the frequency of occurrence of yy in nums is not equal to the frequency of occurrence of xx in nums.

Return an array containing [x,y][x, y]. If no such value yy exists, return [−1,−1][-1, -1].

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100