First and last occurrences of x | EASIEST Python solution Geeksforgeeks interview coding

Опубликовано: 18 Март 2026
на канале: VS Code
99
1

Given a sorted array arr containing n elements with possibly, duplicates are to find indexes of first elements, the task is to find the first and last occurrences of an element x in the given array.
Note: If the number x is not found in the array then return both the indices as -1