Skip to content

Commit bb3caf2

Browse files
authored
Create three-consecutive-odds.py
1 parent 0b6145d commit bb3caf2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Python/three-consecutive-odds.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
class Solution(object):
5+
def threeConsecutiveOdds(self, arr):
6+
"""
7+
:type arr: List[int]
8+
:rtype: bool
9+
"""
10+
count = 0
11+
for x in arr:
12+
count = count+1 if x%2 else 0
13+
if count == 3:
14+
return True
15+
return False

0 commit comments

Comments
 (0)