Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Missing Number From 1 to 1000
00:00
5 left

Missing Number From 1 to 1000

EasyPython

Problem

You have the numbers from 1 to 1000 and one is missing. How can you find it?

Implement the function below. The input list contains every integer from 1 through n except one value, where n = 1000 for the stated problem. The same function may be tested with smaller n values.

Input: nums, a list of integers, and n, the upper bound. Output: the missing integer.

Constraints

  • 2 <= n <= 1000
  • nums.length == n - 1
  • nums contains distinct integers from 1 through n except one value
  • The missing value is guaranteed to exist

Function Signature

def find_missing_number(nums, n):
Interviewer

Your question is Missing Number From 1 to 1000. 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.