NumPy allowed · plain Python earns 10 bonus points
Implement Find First and Last Position -- two binary searches for two different boundaries (the leftmost and rightmost occurrence of a repeated value), the classic real use case for duplicate-tolerant binary search.
Implement search_range(nums, target): run one binary search biased to keep shrinking left after finding a match (to find the FIRST occurrence), and a second biased to keep shrinking right (to find the LAST occurrence).
search_range(nums: list[int], target: int) -> list[int]