#CCBCHBAHAI0000175. Số nguyên cô độc (Lonely Integer)
Số nguyên cô độc (Lonely Integer)
Lonely Integer
Source: HackerRank
Version: Phuoc Hung OJ Extended
Problem
You are given an array of integers. Exactly one value occurs once, while every other value occurs exactly twice.
Find the value that occurs once.
For Chapter 32, the primary solution uses a frequency array over the small value domain.
Input
- The first line contains the odd integer .
- The second line contains .
Output
Print the unique value whose frequency is .
Subtasks
Subtask 1 (20 points): , is odd, ; exactly one value occurs once and every other value occurs exactly twice.
Subtask 2 (30 points): , is odd, ; exactly one value occurs once and every other value occurs exactly twice.
Subtask 3 (50 points): , is odd, ; exactly one value occurs once and every other value occurs exactly twice.
Example
Input
5
0 0 1 2 1
Output
2
Explanation
0 and 1 each occur twice; only 2 occurs once.