Re: [闲聊] 每日leetcode

楼主: sustainer123 (caster)   2024-07-01 10:07:10
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守门员
作者: oin1104 (是oin的说)   2024-07-01 10:18:00
大清早就在卷 我哭了
楼主: sustainer123 (caster)   2024-07-01 10:19:00
早上刷题比较方便安排之后的时间
作者: DJYOMIYAHINA (通通打死)   2024-07-01 10:20:00
别卷了

Links booklink

Contact Us: admin [ a t ] ucptt.com