Opening your workspace…
Workspace/Coding room
Opening your workspace…
The brewery printer recorded a sequence of numbered tickets. Some numbers were printed more than once after customers changed their orders. Find the earliest ticket whose number occurs exactly once in the entire sequence. Return its zero-based index, or -1 if there is no such ticket. A ticket that looks unique at first may be repeated later.
[12,7,12,9,7,4]OUTPUT39 and 4 appear once. The earlier of them is 9 at index 3.
[0,8,8]OUTPUT0Ticket 0 appears once and its index is 0; neither zero is a missing value.
Tab inserts two spaces. Press Escape, then Tab, to leave the editor. Press Control or Command and Enter to submit.
[12,7,12,9,7,4]3Public samples only. These checks do not award ranked points.
Walk through a solution, check its time and space costs, and compare it with yours.
Checking your progress…