Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Find Missing Number

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.

Requirements

  • Exactly one number is missing.

Constraints

  • nums has length n and values in 0..n.

Examples

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

beginner

Find Missing Number

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.