Python data engineering interview problem. Difficulty: beginner. Pattern: Arrays. About 10 minutes. Free to practice.
Find the missing number from the range 0..n given n numbers. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement missing_number(nums: list) -> int where nums contains n distinct numbers from 0..n with one missing.
Input: missing_number([3, 0, 1]) Output: 2 0..3 missing 2.
Topics: lakebench, python, math, xor.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Find the missing number from the range 0..n given n numbers.
Implement `missing_number(nums: list) -> int` where nums contains n distinct numbers from `0..n` with one missing. Example: `[3, 0, 1]` → `2`. Keep the harness.