Trains the technique from
LeetCode 645Set MismatchThis 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 road race orders one bib per runner, so a field of n runners should receive the numbers 1 through n, each on a single bib. The press misfired: one number came out on two bibs and one number never came out at all. Every other number landed on exactly one bib.
You are given the integer array bibs of length n holding the number printed on each bib, in the order the bibs came off the press. Return a two-element array [repeated, absent], where repeated is the number printed on two bibs and absent is the number in the range 1 to n printed on none of them.
Example 1
Three bibs came off the press for a field of 3 runners. The number 3 sits on two of them and no bib carries 2, so the answer is [3, 2].
Example 2
Two bibs carry the number 2 and no bib carries 4.
Example 3
The number 5 appears on two bibs, and 4 is the number in the range 1 to 6 that is missing.
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 find_bib_slip(bibs: list[int]) -> list[int]:public int[] findBibSlip(int[] bibs)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.