- You are given a number n, representing the size of array a.
- You are given n numbers, representing elements of array a.
- You are given a number k
- And You have to find its first occurrence in the array as well as its last occurrence.
- Asssumption- Array is sorted. Array may have duplicate values.
Example 1:
Input: n = 15 a[] = {1, 5, 10, 15, 22, 33, 33, 33, 33, 33, 40, 42, 55, 66, 77} k = 33 Output: 5 9
Constraints:
1 <= n <= 1000
1 <= n1, n2, .. n elements <= 100
1 <= d <= 100