Meta Data#
Difficulty: easy First Attempt: 2025-05-11
- Total time: 05:00.00
Intuition#
Set a counter to track the number of consecutive odd numbers.
If the count reaches 3, return the result early.
Approach#
class Solution:
def threeConsecutiveOdds(self, arr: List[int]) -> bool:
count = 0
for num in arr:
if num%2:
count+=1
else:
count = 0
if count == 3:
return True
return False