← 返回 apple 的题目列表Find First Unique Number in an Array
类型:online_judge
Given an array of integers, find the first unique number in the array. If there is no such number, return -1.
Input format:
An array consisting of n integers, where each integer is within the range [-10^9, 10^9].
Output format:
The first unique number. If all numbers are duplicated, return -1.
Example:
Input: [4, 5, 1, 2, 0, 4] Output: 5
Input: [1, 2, 2, 1, 3] Output: 3
Input: [1, 1] Output: -1
Constraints:
The length of the array is between 1 and 10^5.
Example
Input
[4, 5, 1, 2, 0, 4]