Picks up where Binary search left off.
You wrote binary search. Extend it: with duplicates, return the leftmost index of target, or -1.
Write first_occurrence(nums, target).
Starter:
def first_occurrence(nums, target):
# TODO
pass
Solve it interactively in your browser (no setup), check your answer instantly, and keep your daily streak going on IWTLP: https://iwtlp.com/challenge
Top comments (0)