Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Find Missing Number in Array
00:00
5 left

Find Missing Number in Array

EasyPython

Problem

Given an array of integers nums containing n distinct numbers taken from 0 to n, find the one number that is missing from the array.

You must implement an algorithm that runs in O(n) time and uses O(n) space.

Constraints

  • n == nums.length
  • 0 <= n <= 10^4
  • All numbers are distinct

Function Signature

def missing_number(nums: list[int]) -> int:
Interviewer

Your question is Find Missing Number in Array. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.