First and last position of a target
A sorted array (ascending, duplicates allowed) may contain a target several times in a contiguous block. You want the block's boundaries.
a = [5, 7, 7, 8, 8, 8, 10], target = 8 -> [3, 5]
a = [5, 7, 7, 8, 8, 8, 10], target = 6 -> [-1, -1]
a = [2, 2], target = 2 -> [0, 1]
Return [first, last], the smallest and largest index of target, or [-1, -1] if absent. Aim for .
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.