Find the Duplicate Number
Every delegate at the Harborview tech conference is issued a numbered badge, and the door scanner writes the badge number to a log each time someone walks in. Badge numbers are unique to a person, so a number that turns up twice means somebody stepped out and came back -- and the organisers want that number, because whoever it is still has the spare lanyard from the front desk.
Task: Print the badge number that appears more than once in the log.
Input
A single line holding 2 to 1000 integers separated by single spaces. Exactly one value is repeated -- it appears two or more times -- and every other value appears exactly once. The repeats are not necessarily next to each other.
Output
One line holding that repeated number on its own, and nothing else.
Example:
Input:
1 3 4 2 2
Output:
2
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in