Solution: Longest Mountain in Array
C# solution for the Longest Mountain in Array problem using the Two Pointers pattern.
We'll cover the following...
We'll cover the following...
Statement
Given an integer array arr, return the length of the longest contiguous subarray that forms a mountain.
A subarray arr[l..r] is a mountain if all of the following are true:
A mountain has length at least
There exists an index p with l < p < r such that arr[l] < arr[l+1] < ... < arr[p] and arr[p] > arr[p+1] > ... > arr[r].
In other words, the values strictly increase up to a single peak, then strictly decrease after the peak.
If no mountain exists in arr, return