herrDeng網內搜尋

自訂搜尋

Ads

2025年2月26日 星期三

C++ prefix sum Kadane Python一行解Leetcode 1749. Maximum Absolute Sum of An...



class Solution:
    def maxAbsoluteSum(self, nums: List[int]) -> int:
        return max(0, max(K:=list(accumulate(nums))))-min(0, min(K))
        
        
  

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章