Google | Phone | Largest Mountain
Anonymous User
2633
Apr 03, 2020
Apr 04, 2020

Given an array of numbers, find the largest interval which is a "mountain": the two endpoints are both strictly smaller than all elements in between.

For example:
[2, 4, 5, 3, 6, 4, 7, 3]
The interval [0, 3] is a mountain, but [3, 7] is the largest mountain. [0, 7] is not a mountain because 3 == 3.

Any leads will be appreciated.

Comments (22)