Free round · easy · about 15 min
Badge Scanner Duplicates
Solve it here, in your browser. No account needed.
An automated turnstile at a security gate records the numeric badge ID of every attendee as they scan in. To flag suspicious double-scans or shared badges, security needs to identify the first badge ID that appears a second time in the scan sequence.
Given an array of integer badgeIds in chronological order of scans, return the badge ID of the first duplicate scan encountered.
If all badge IDs in the sequence are unique, return -1.
Visible tests
Write your solution, then press Run. Your code runs in your browser; nothing is sent to us.
The full round adds
- Hidden edge-case and speed tests
- Mocky, the AI assistant, with a two-prompt budget
- A score, a debrief and your progress over time
- Six more languages, from Java to Go