ORIGINAL CODING QUESTION
Missing sequence ID
The n supplied IDs are distinct members of 0..n. Return the one missing ID.
Original exercise · easy. Editorial role relevance does not imply a company has asked this question.
Input and output
n, then n integer values. Print one integer as described.
Constraints
1 ≤ n ≤ 200; IDs are distinct integers in [0,n].
Example 1
Input
3 3 0 1
Output
2
ID 2 is absent.
Example 2
Input
1 0
Output
1
ID 1 is absent.
Explain your approach
Explain your time and auxiliary space complexity. Which input makes your algorithm work hardest?
Private grading inputs, expected outputs and canonical reference implementations are withheld. Authored expected outputs were cross-checked with independent reference oracles; compiler/runtime behavior still needs a verified execution provider.
Hint 1
Exactly one ID is missing.
Hint 2
Compare the full expected collection with the actual one.
Hint 3
XOR cancels matched IDs without needing extra membership storage.
Practice this question
Save your work privately, explain decisions and return to your revision queue.
Open practice workspaceBrowse the question library →