Mountain

Write a function that take an input of an array of distint intergers and return the length of heighest mountain.

A mountain is defined as adjacent interger that are strictly increasing untill they reached the peak. at which it becomes strictly decreasing

Atleast three number are required to form a montain.

Sample Input : -

[5,6,1,2,3,4,5,4,3,2,0,1,2,3,-2,4]

Sample Output : -

9

Intitution : -

  |
| |         |
| |       | | |               |
| |     | | | | |         |   |
| |   | | | | | | |     | |   |
| | | | | | | | | |   | | |   |
                            |
                            |
5 6 1 2 3 4 5 4 3 2 0 1 2 3 -2 4

Trick 1: - Identify Peak...

a[i-1] < a[i] > a[i+1]

then Identify How big the peak is ?? Check the left part and as well as the right part of the array

Related Questions
Find Peak Index