941. Valid Mountain Array Easy
1/**
2 * [941] Valid Mountain Array
3 *
4 * Given an array of integers arr, return true if and only if it is a valid mountain array.
5 * Recall that arr is a mountain array if and only if:
6 *
7 * arr.length >= 3
8 * There exists some i with 0 < i < arr.length - 1 such that:
9 *
10 * arr[0] < arr[1] < ... < arr[i - 1] < arr[i]
11 * arr[i] > arr[i + 1] > ... > arr[arr.length - 1]
12 *
13 *
14 * <img src="https://assets.leetcode.com/uploads/2019/10/20/hint_valid_mountain_array.png" width="500" />
15 *
16 * Example 1:
17 * Input: arr = [2,1]
18 * Output: false
19 * Example 2:
20 * Input: arr = [3,5,5]
21 * Output: false
22 * Example 3:
23 * Input: arr = [0,3,2,1]
24 * Output: true
25 *
26 * Constraints:
27 *
28 * 1 <= arr.length <= 10^4
29 * 0 <= arr[i] <= 10^4
30 *
31 */
32pub struct Solution {}
33
34// problem: https://leetcode.com/problems/valid-mountain-array/
35// discuss: https://leetcode.com/problems/valid-mountain-array/discuss/?currentPage=1&orderBy=most_votes&query=
36
37// submission codes start here
38
39impl Solution {
40 pub fn valid_mountain_array(arr: Vec<i32>) -> bool {
41 false
42 }
43}
44
45// submission codes end
46
47#[cfg(test)]
48mod tests {
49 use super::*;
50
51 #[test]
52 fn test_941() {
53 }
54}
55
Back
© 2025 bowen.ge All Rights Reserved.