Skip to content

Commit 2ff611a

Browse files
authored
Update Solution.java
1 parent 9f23388 commit 2ff611a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
class Solution {
22
public boolean threeConsecutiveOdds(int[] arr) {
33
int cnt = 0;
4-
for (int v : arr) {
5-
if (v % 2 == 1) {
6-
++cnt;
4+
for (int x : arr) {
5+
if (x % 2 == 1) {
6+
if (++cnt == 3) {
7+
return true;
8+
}
79
} else {
810
cnt = 0;
911
}
10-
if (cnt == 3) {
11-
return true;
12-
}
1312
}
1413
return false;
1514
}
16-
}
15+
}

0 commit comments

Comments
 (0)