精華區beta Marginalman 關於我們 聯絡資訊
https://leetcode.com/problems/three-consecutive-odds 1550. Three Consecutive Odds 給定一個array 假設此數列有連續三個奇數 回傳True 反之回傳False 思路: 記數 Python Code: class Solution: def threeConsecutiveOdds(self, arr: List[int]) -> bool: count = 0 for num in arr: if num % 2 == 1: count += 1 else: count = 0 if count == 3: return True return False 我是ez守門員 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.194.160.111 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1719799634.A.701.html
oin1104: 大清早就在卷 我哭了 07/01 10:18
sustainer123: 早上刷題比較方便安排之後的時間 07/01 10:19
DJYOMIYAHINA: 別捲了 07/01 10:20