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 <= 2000
- 0 <= nums[i] <= 1000
와 오늘은 하기싫어 몸이 배배꼬여서 강제로 손 코딩!!!!!!!!!!!!!! 이해완료. key 와 val 값은 정해진게아니구나
'Data Structure & Algorithms > Hasing' 카테고리의 다른 글
[Hashing] 2260. Minimum Consecutive Cards to Pick Up (0) | 2023.03.17 |
---|---|
[Hashing] 해쉬를 핵심만 정리해보자 (0) | 2023.03.12 |
[Hashing] 383. Ransom Note (0) | 2023.01.06 |
[Hashing] Find Players With Zero or One Losses (0) | 2023.01.06 |
[Hashing] Maximum Number of Balloons (0) | 2023.01.03 |
댓글