This commit is contained in:
commit
265fcfa6b1
1 changed files with 15 additions and 0 deletions
15
easy/three_consecutive_odds.py
Normal file
15
easy/three_consecutive_odds.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#https://leetcode.com/problems/three-consecutive-odds
|
||||
from typing import List
|
||||
|
||||
class Solution:
|
||||
def threeConsecutiveOdds(self, arr: List[int]) -> bool:
|
||||
cnt = 0
|
||||
for v in arr:
|
||||
if v % 2 == 0:
|
||||
cnt = 0
|
||||
continue
|
||||
cnt += 1
|
||||
if cnt >= 3:
|
||||
break
|
||||
return cnt >= 3
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue