Given a sorted array `nums` with possible duplicate elements, find the first and last occurrences of a given `target` value. If the target is not found in the array, return `[-1, -1]`.
{
"nums": [
5,
7,
7,
8,
8,
10
],
"target": 8
}[
3,
4
]{
"nums": [
5,
7,
7,
8,
8,
10
],
"target": 6
}[
-1,
-1
]{
"nums": [],
"target": 0
}[
-1,
-1
]Sign in to Run Code and Submit