Skip to content

Commit ee6f6a1

Browse files
authored
Update Solution.ts
1 parent 9e0b128 commit ee6f6a1

File tree

1 file changed

+5
-6
lines changed
  • solution/1500-1599/1550.Three Consecutive Odds

1 file changed

+5
-6
lines changed
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
function threeConsecutiveOdds(arr: number[]): boolean {
22
let cnt = 0;
3-
for (const v of arr) {
4-
if (v & 1) {
5-
++cnt;
3+
for (const x of arr) {
4+
if (x & 1) {
5+
if (++cnt == 3) {
6+
return true;
7+
}
68
} else {
79
cnt = 0;
810
}
9-
if (cnt == 3) {
10-
return true;
11-
}
1211
}
1312
return false;
1413
}

0 commit comments

Comments
 (0)