Tap here to switch tabs
Problem
Submissions

Problem: First Element with Unique Frequency

Try to solve the First Element with Unique Frequency problem.

Statement

Given an integer array nums, find the first element in nums whose frequency of occurrence is unique among all distinct elements in the array.

An element has a unique frequency if no other distinct value appears in nums the exact same number of times.

Return the value of this first element. If no element possesses a unique frequency, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: First Element with Unique Frequency

Try to solve the First Element with Unique Frequency problem.

Statement

Given an integer array nums, find the first element in nums whose frequency of occurrence is unique among all distinct elements in the array.

An element has a unique frequency if no other distinct value appears in nums the exact same number of times.

Return the value of this first element. If no element possesses a unique frequency, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5