how can i find the element before the min element in list??
Answers
Answered by
0
Explanation:
Given an array, find an element before which all elements are smaller than it, and after which all are greater than it. Return the index of the element if there is such an element, otherwise, return -1.
Examples:
Input: arr[] = {5, 1, 4, 3, 6, 8, 10, 7, 9};
Output: 4
Explanation: All elements on left of arr[4] are smaller than it
and all elements on right are greater.
Input: arr[] = {5, 1, 4, 4};
Output: -1
Explanation : No such index exits.
Expected time complexity: O(n).
hope it will help you
thanks
follow and mark me brainlist
Similar questions