Which is missing? (2)

We handle lists that contain n − 1 integers, all between 0 and n − 1
(both included), and all different. Therefore, exactly one of these n
numbers is missing. Which one?

Write a function missing(lst) that receives such a list and returns the
missing number.

Precondition: we are ensured that the list lst received by the function
will always fulfill the condition that it contains nonnegative integers
less than n, all different, where n is one more than the length of lst
(hence, n > 0 is also guaranteed as the smallest list has length zero).

Problem information

Author: Jordi Petit (adapted by José Luis Balcázar)

Generation: 2026-01-25T17:09:38.335Z

© Jutge.org, 2006–2026.
https://jutge.org
