Skip to content

Commit ad6f88f

Browse files
solves
1 parent 6a9c74d commit ad6f88f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@
911911
| 3136 | [Valid Word](https://leetcode.com/problems/valid-word) | [![Java](assets/java.png)](src/ValidWord.java) | |
912912
| 3142 | [Check if Grid Satisfies Conditions](https://leetcode.com/problems/check-if-grid-satisfies-conditions) | [![Java](assets/java.png)](src/CheckIfGridSatisfiesConditions.java) | |
913913
| 3146 | [Permutation Difference between Two Strings](https://leetcode.com/problems/permutation-difference-between-two-strings) | [![Java](assets/java.png)](src/PermutationDifferenceBetweenTwoStrings.java) | |
914-
| 3151 | [Special Array I](https://leetcode.com/problems/special-array-i) | | |
914+
| 3151 | [Special Array I](https://leetcode.com/problems/special-array-i) | [![Java](assets/java.png)](src/SpecialArrayI.java) | |
915915
| 3158 | [Find the XOR of Numbers Which Appear Twice](https://leetcode.com/problems/find-the-xor-of-numbers-which-appear-twice) | | |
916916
| 3162 | [Find the Number of Good Pairs I](https://leetcode.com/problems/find-the-number-of-good-pairs-i) | | |
917917
| 3168 | [Minimum Number of Chairs in a Waiting Room](https://leetcode.com/problems/minimum-number-of-chairs-in-a-waiting-room) | | |

src/SpecialArrayI.java

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// https://leetcode.com/problems/special-array-i
2+
// T: O(N)
3+
// S: O(1)
4+
5+
public class SpecialArrayI {
6+
public boolean isArraySpecial(int[] array) {
7+
for (int i = 0 ; i < array.length - 1 ; i++) {
8+
if (array[i] % 2 == array[i + 1] % 2) {
9+
return false;
10+
}
11+
}
12+
return true;
13+
}
14+
}

0 commit comments

Comments
 (0)