Find first and last positions of an element in a sorted array
Given a sorted array arr[] with possibly some duplicates, 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.Examples: Input : arr[] = [1, 3, 5, 5, 5, 5, 67, 123, 125], x = 5Output :