Watch 10 video solutions for Largest Unique Number, a easy level problem involving Array, Hash Table, Sorting. This walkthrough by Ashish Pratap Singh has 1,002,155 views views. Want to try solving it yourself? Practice on FleetCode or read the detailed text solution.
Given an integer array nums, return the largest integer that only occurs once. If no integer occurs once, return -1.
Example 1:
Input: nums = [5,7,3,9,4,9,8,3,1] Output: 8 Explanation: The maximum integer in the array is 9 but it is repeated. The number 8 occurs only once, so it is the answer.
Example 2:
Input: nums = [9,9,8,8] Output: -1 Explanation: There is no number that occurs only once.
Constraints:
1 <= nums.length <= 20000 <= nums[i] <= 1000