loading…
Write search_range(nums, target) for a sorted list with duplicates. Return [first, last] index of target, or [-1, -1], in O(log n).
search_range([5, 7, 7, 8, 8, 10], 8) -> [3, 4]
search_range([5, 7, 7, 8, 8, 10], 6) -> [-1, -1]
Stuck on the idea itself? The binary search lesson walks through the pattern from scratch.