Trains the technique from
LeetCode 268Missing NumberThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A site office owns one visitor badge for each whole number from 0 up to and including n. At closing time a clerk empties the drop tray and writes down what she finds there.
You get her note as the array returned. Its length is n, no number shows up twice, and each number she wrote sits somewhere in 0 through n inclusive, so exactly one badge of the set failed to come back.
Report the number printed on the badge that is still out.
Example 1
Five badges came back, so the office owns badges 0 through 5. Only 3 is absent from the tray.
Example 2
One badge came back out of the pair numbered 0 and 1, and the one still out is the higher of the two.
Example 3
The tray covers 0 through 6 apart from 4, which never made it back.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def unclaimed_badge(returned: list[int]) -> int:public int unclaimedBadge(int[] returned)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.