Peak Elements Count
N integers are passed
as input. The program must print the count of peak elements among the N integers
. An element is a peak element if it is greater than it's neighbours (the elements to the left and right).
The elements present in the extreme left and right can never be peak elements.
The first line contains N.
The second line contains N integer values separated by a space.
The first line contains the count of peak elements.
2 <= N <= 1000
Example Input/Output 1:
1 2 3 1 3
Example Input/Output 2:
1 2 3 4 5
int main(int argc, char** argv)
Please do comment If u have any Queries!