Back to course home
0% completed
Vote For New Content
Valid Mountain Array (easy)
Problem Statement
Given an integer array arr, return true if arr is a valid mountain array. Otherwise, return false.
The array is called a valid mountain array if:
- arr.length > 2
- There exists some iwith0 < i < arr.length - 1such that:- arr[0] < arr[1] < ... < arr[i - 1] < arr[i]
- arr[i] > arr[i + 1] > ... > arr[arr.length - 1]
 
Examples
Example 1:
- Input: arr = [4, 5, 6, 7, 8, 7, 6, 5]
- Expected Output: true
- Justification: The elements increase from 4to8and then decrease from8back to `5
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page