File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 178
178
1496|[ Path Crossing] ( ./1496-path-crossing.js ) |Easy|
179
179
1502|[ Can Make Arithmetic Progression From Sequence] ( ./1502-can-make-arithmetic-progression-from-sequence.js ) |Easy|
180
180
1507|[ Reformat Date] ( ./1507-reformat-date.js ) |Easy|
181
+ 1550|[ Three Consecutive Odds] ( ./1550-three-consecutive-odds.js ) |Easy|
181
182
1598|[ Crawler Log Folder] ( ./1598-crawler-log-folder.js ) |Easy|
182
183
1780|[ Check if Number is a Sum of Powers of Three] ( ./1780-check-if-number-is-a-sum-of-powers-of-three.js ) |Medium|
183
184
1880|[ Check if Word Equals Summation of Two Words] ( ./1880-check-if-word-equals-summation-of-two-words.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 1550. Three Consecutive Odds
3
+ * https://leetcode.com/problems/three-consecutive-odds/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given an integer array arr, return true if there are three consecutive odd
7
+ * numbers in the array. Otherwise, return false.
8
+ */
9
+
10
+ /**
11
+ * @param {number[] } arr
12
+ * @return {boolean }
13
+ */
14
+ var threeConsecutiveOdds = function ( arr ) {
15
+ for ( let i = 0 , count = 0 ; i < arr . length ; i ++ ) {
16
+ count = arr [ i ] % 2 !== 0 ? count + 1 : 0 ;
17
+ if ( count === 3 ) return true ;
18
+ }
19
+ return false ;
20
+ } ;
You can’t perform that action at this time.
0 commit comments