본문 바로가기
python-algorithm

leetcode 1550. Three Consecutive Odds

by 무적김두칠 2022. 4. 4.

1
2
3
4
5
6
7
8
class Solution:
    def threeConsecutiveOdds(self, arr: List[int]) -> bool:
        ans=False
        for i in range(2,len(arr)):
            if arr[i]%2 == 1 and arr[i-1]%2 == 1 and arr[i-2]%2 == 1 :
                ans = True
                break
        return ans
cs
반응형

'python-algorithm' 카테고리의 다른 글

leetcode 169. Majority Element  (0) 2022.04.08
leetcode 258. Add Digits  (0) 2022.04.08
leetcode 1800. Maximum Ascending Subarray Sum  (0) 2022.04.04
leetcode 896. Monotonic Array  (0) 2022.03.28
leetcode 1185. Day of the Week  (0) 2022.03.28

댓글