Given a sorted array and a target, return the first and last positions (0-indexed) of the target as a two-element array [first, last]. If the target is absent, return [-1, -1]. Input: '[arr], target'.
Input: '[arr], target'.
Output: Array — [first, last] or [-1, -1].
Input: [5,7,7,8,8,10], 8
Output: [3,4]
Explanation: 8 spans indices 3 to 4.Input: [5,7,7,8,8,10], 6
Output: [-1,-1]
Explanation: 6 is absent.Input: [1], 1
Output: [0,0]
Explanation: Single occurrence.0<=n<=10^5sorted ascending