C#/Haskell enthusiast [:oceanator]
A simple way to solve this problem is to use DP. Pre-processing reduces the time complexity significantly.
For each element, find the largest element to its left.
For each element, find the largest element to its right.