FunctionRacerProblemsRace

Missing From a Range

EasyBitsPython, JavaScript, TypeScript, Java, C++

nums holds every integer from lo to hi (both included) exactly once, except for one integer that is missing. The order is scrambled. Return the missing integer. nums has hi - lo items, so exactly one value of the range is absent.

Example 1

nums [3,1,4]
lo 1
hi 4
returns 2

The range 1 to 4 is 1, 2, 3, 4 and the list lacks 2.

Example 2

nums [2,3]
lo 1
hi 3
returns 1

The range 1 to 3 is 1, 2, 3 and the list lacks 1.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Bits problems