We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e43323b commit 30685b8Copy full SHA for 30685b8
problems/0941.有效的山脉数组.md
@@ -196,7 +196,22 @@ public class Solution {
196
}
197
```
198
199
-
+### Rust
200
+```rust
201
+impl Solution {
202
+ pub fn valid_mountain_array(arr: Vec<i32>) -> bool {
203
+ let mut i = 0;
204
+ let mut j = arr.len() - 1;
205
+ while i < arr.len() - 1 && arr[i] < arr[i + 1] {
206
+ i += 1;
207
+ }
208
+ while j > 0 && arr[j] < arr[j - 1] {
209
+ j -= 1;
210
211
+ i > 0 && j < arr.len() - 1 && i == j
212
213
+}
214
+```
215
216
<p align="center">
217
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
0 commit comments