Missing Number
Updated Feb 24, 2026
Problem
Given distinct numbers in [0, n], return the missing number.
Constraints
1 <= nums.length <= 10^4
Examples
Example 1
Input:
{"nums": [3, 0, 1]}
Output:
2
Function Signature
def missingNumber(self, nums: list[int]) -> int
How to Submit
Implement a Solution class with a missingNumber method.
Your method will be called with the input parameters and should return the answer.