Write a program to find previous and next number of a given no
Answers
Answered by
0
Answer:
Input : arr[] = {2, 3, 1, 5, 4, 9, 8, 7, 5}
Output : 3, 5, 9
In above given example 3 is greater than its
left element 2 and right element 1.
Similar logic is applied to other elements
hence our final output is 3, 5, 9.
Input : arr[] = {1, 2, 3, 2, 1}
Output : 3
Similar questions