Skip to content

Commit 7fba8f7

Browse files
authored
Create 1550. Three Consecutive Odds1 (#792)
2 parents 59db021 + 4fb2a43 commit 7fba8f7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

1550. Three Consecutive Odds1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
bool threeConsecutiveOdds(vector<int>& arr) {
4+
int count = 0;
5+
for (int num : arr) {
6+
if (num % 2 == 1) {
7+
count++;
8+
if (count == 3) return true;
9+
} else {
10+
count = 0;
11+
}
12+
}
13+
return false;
14+
}
15+
};

0 commit comments

Comments
 (0)