#3843

First Element with Unique Frequency

medium · 69.7% accepted · 73 likes · top 78%

array · hash table · counting

Description

You are given an integer array nums.

Return an integer denoting the first element (scanning from left to right) in nums whose frequency is unique. That is, no other integer appears the same number of times in nums. If there is no such element, return -1.

Solution