Solution: Missing Number in a Sorted List
This review discusses the solution of the missing number in a sorted list challenge in detail.
We'll cover the following...
We'll cover the following...
Solution: 1
A naive solution to this problem is traversing through the whole list, starting from the first index and returning the missing integer as soon as we encounter it.
Explanation
- Line 7:
actual_numberis initialized with 1 as the list is supposed to start with 1 - Line 10: Compare each element of the list with the
actual_number - Line 11: If any number in the list doesn’t match with the
actual_number