0 out of 464 challenges solved
Write a Python function to find the smallest missing number from a sorted list of natural numbers. The list is guaranteed to be sorted in ascending order, and it may contain duplicates. The function should efficiently determine the smallest missing number using a binary search approach. #### Example Usage ```python [main.nopy] find_smallest_missing([0, 1, 2, 3]) # Output: 4 find_smallest_missing([0, 1, 2, 6, 9]) # Output: 3 find_smallest_missing([2, 3, 5, 8, 9]) # Output: 0 ``` #### Constraints - The input list will only contain non-negative integers. - The list will be sorted in ascending order. - The function should aim for a time complexity of O(log n).
def find_smallest_missing(arr): """ Find the smallest missing number in a sorted list of natural numbers. Args: arr (list): A sorted list of non-negative integers. Returns: int: The smallest missing number. """ # Implement the binary search logic here pass