![]() |
VOOZH | about |
Given an array of positive integers, the task is to find a point/element up to which elements form a strictly decreasing sequence first followed by a sequence of strictly increasing integers.
Note: Print "No such element exist", if not found.
Examples:
Input: arr[] = {3, 2, 1, 2}
Output: 1
{3, 2, 1} is strictly decreasing
then {1, 2} is strictly increasing.
Input: arr[] = {3, 2, 1}
Output: No such element exist
Approach:
Note: If any of the two elements are equal then also print "No such element exist" as it should be strictly decreasing and increasing.
Below is the implementation of above approach:
1
Complexity Analysis: