File tree 1 file changed +0
-35
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-35
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 896. Monotonic Array
5
- *
6
- * An array is monotonic if it is either monotone increasing or monotone decreasing.
7
- *
8
- * An array A is monotone increasing if for all i <= j, A[i] <= A[j].
9
- * An array A is monotone decreasing if for all i <= j, A[i] >= A[j].
10
- *
11
- * Return true if and only if the given array A is monotonic.
12
- *
13
- * Example 1:
14
- * Input: [1,2,2,3]
15
- * Output: true
16
- *
17
- * Example 2:
18
- * Input: [6,5,4,4]
19
- * Output: true
20
- *
21
- * Example 3:
22
- * Input: [1,3,2]
23
- * Output: false
24
- *
25
- * Example 4:
26
- * Input: [1,2,4,5]
27
- * Output: true
28
- *
29
- * Example 5:
30
- * Input: [1,1,1]
31
- * Output: true
32
- *
33
- * Note:
34
- *
35
- * 1 <= A.length <= 50000
36
- * -100000 <= A[i] <= 100000
37
- */
38
3
public class _896 {
39
4
public static class Solution1 {
40
5
public boolean isMonotonic (int [] A ) {
You can’t perform that action at this time.
0 commit comments