Find First And Last Postion Of Element In Sorted Array
easy
1. Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. 2. If target is not found in the array, return [-1, -1]. 3. You must write an algorithm with O(log n) runtime complexity.
Constraints
0 <= nums.length <= 10^5 -10^9 <= nums[i] <= 10^9 nums is a non-decreasing array. -10^9 <= target <= 10^9
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
7
2 2 3 3 3 4 5
3
Sample Output
2 4
Question Video