Backend Engineer
Senior
programming
Write a function that finds the first and last position of a target value in a sorted array. If the target is not found, return [-1, -1]. ### Function Signature ```python def search_range(nums: List[int], target: int) -> List[int]: ``` ### Constraints - `0 <= nums.length <= 10^5` - `-10^9 <= nums[i], target <= 10^9` ### Examples 1. Input: `search_range([5,7,7,8,8,10], 8)` Output: `[3, 4]` 2. Input: `search_range([5,7,7,8,8,10], 6)` Output: `[-1, -1]`
Suggested Answer