Problem
Given a sorted array of integers and a target value, find the index of the first and the last occurrence of the target. If the target is not present, return [-1, -1]. Aim for O(log n) time.
Input / Output
nums and an integer target.[firstIndex, lastIndex], or [-1, -1] if the target is absent.Constraints
0 <= nums.length <= 10^5Example
nums = [5,7,7,8,8,10], target = 8 -> [3,4]nums = [5,7,7,8,8,10], target = 6 -> [-1,-1]