Skip to content

Commit 423d2e1

Browse files
authored
Create 1550-three-consecutive-odds.js
1 parent 9aaf634 commit 423d2e1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

1550-three-consecutive-odds.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @param {number[]} arr
3+
* @return {boolean}
4+
*/
5+
const threeConsecutiveOdds = function(arr) {
6+
for(let i = 1, n = arr.length; i < n - 1; i++) {
7+
if(arr[i] & 1 === 1 && arr[i - 1] & 1 === 1 && arr[i + 1] & 1 === 1) return true
8+
}
9+
return false
10+
};

0 commit comments

Comments
 (0)