Find the First True Boundary
Binary search for the first True: if mid is True, save it and keep looking to the left.
The problem
Implement find_first_true(flags). flags holds zero or more False values followed by zero or more True values. Return the index of the first True, or len(flags) if there is no True. For example, [False, False, True, True] gives 2 and [False, False] gives 2. Aim for O(log n) time.
Starter code
def find_first_true(flags):
passPublic examples
flags = [False, False, True, True]gives2flags = [True, True]gives0
Solving it in the practice book needs an active paid plan.
Open it in the practice bookOne thought at a time.
