Re: [闲聊] 每日leetcode

楼主: DJYOMIYAHINA (通通打死)   2025-02-02 22:28:30
过完年连绿色题目都不会了...
我好想那个
def check(self, nums: List[int]) -> bool:
pre = nums[-1]
fail_cnt = 0
for i in range(len(nums)):
if nums[i]<pre:
fail_cnt += 1
if fail_cnt >= 2:
return False
pre = nums[i]
return True

Links booklink

Contact Us: admin [ a t ] ucptt.com