5 3 1 2 3 4 5
For this input, the required output is 3.
3
5 6 1 2 3 4 5
For this input, the required output is -1.
-1
7 2 1 2 2 2 3 4 5
For this input, the required output is 2.
2
Given a sorted array of nnn integers in non-decreasing order and a target value xxx, find the index of the first occurrence of xxx in the array.
Output the 1-indexed position, or −1-1−1 if xxx is not found.