File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 389
389
| 1534 | [ Count Good Triplets] ( https://leetcode.com/problems/count-good-triplets ) | [ ![ Java] ( assets/java.png )] ( src/CountGoodTriplets.java ) | |
390
390
| 1539 | [ Kth Missing Positive Number] ( https://leetcode.com/problems/kth-missing-positive-number ) | [ ![ Java] ( assets/java.png )] ( src/KthMissingPositiveNumber.java ) | |
391
391
| 1544 | [ Make The String Great] ( https://leetcode.com/problems/make-the-string-great ) | [ ![ Java] ( assets/java.png )] ( src/MakeTheStringGreat.java ) | |
392
+ | 1550 | [ Three Consecutive Odds] ( https://leetcode.com/problems/three-consecutive-odds ) | [ ![ Java] ( assets/java.png )] ( src/ThreeConsecutiveOdds.java ) | |
Original file line number Diff line number Diff line change
1
+ public class ThreeConsecutiveOdds {
2
+ public boolean threeConsecutiveOdds (int [] array ) {
3
+ for (int i = 0 ; i < array .length - 2 ; i ++) {
4
+ if (isOdd (array [i ]) && isOdd (array [i + 1 ]) && isOdd (array [i + 2 ])) {
5
+ return true ;
6
+ }
7
+ }
8
+ return false ;
9
+ }
10
+
11
+ private boolean isOdd (int x ) {
12
+ return (x & 1 ) == 1 ;
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments