/* 自定義代碼塊樣式 */

herrDeng網內搜尋

自訂搜尋

Ads

2026年5月23日 星期六

Leetcode 1752 | 1-Line Python & 0ms C++ Solution


[Py3 1-liner請進]

class Solution:
    def check(self, nums: List[int]) -> bool:
        return (cntD:=sum(y < x for x, y in pairwise(nums)))== 0 or (cntD 1 and nums[-1]<=nums[0])

        

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章