#3843
First Element with Unique Frequency
pupil · 575 · lc medium +29 · 69.7% accepted · 73 likes · top 78%
Description
Given an integer array nums, scan from left to right and return the first element whose occurrence count in nums is not shared by any other element. If every element's frequency is matched by at least one other element, return -1.
Code
1
2
3