Missing Number in 1-100

Finding the Missing Number 1 to 100 is an easy quant interview question on Algorithms.

Difficulty Easy Topic Algorithms

This question asks you to find a single missing value from an otherwise complete set of consecutive integers, given only an unsorted array containing the rest. The setup is deliberately minimal: no extra structure, no ordering guarantees, and no allowance for duplicates. It is a classic warm-up algorithm often used in software engineer and quant developer interviews to probe basic reasoning about data structures and simple invariants. Variants of this style of problem are common at big tech firms and in coding screens where the interviewer wants to see whether you can quickly recognize a standard pattern and choose an efficient approach in time and space.

On the conceptual side, the problem leans on understanding aggregate properties of collections and how to exploit them algorithmically. Candidates may reach for arithmetic series formulas, bitwise tricks, or bookkeeping with auxiliary data structures, and the interviewer observes the trade-offs they choose. They are looking for clarity on time and space complexity, awareness of integer overflow and edge cases, and the ability to derive and justify a solution rather than rely solely on memorized patterns.

What it tests

This problem class is governed by the principle of invariants and conservation: when a collection is missing a single known element, comparing the aggregate property (such as the sum) of the complete set to that of the incomplete set reveals the discrepancy. The sum of a sequence of consecutive integers is a well-defined, easily computable quantity, and removing one element from the set reduces the total by exactly that element's value. This approach works because the sum operation is both linear and lossless with respect to the missing element: no information about which element is missing is lost in the subtraction. The general insight is that aggregate properties like sum, product, or XOR can encode the presence or absence of individual elements in a set, making them powerful tools for detection and recovery.

Practise this question with written feedback, or hear it in a spoken mock interview.

Get started free