mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 08:50:15 +08:00
优化
This commit is contained in:
@ -224,7 +224,7 @@ class Solution:
|
||||
def lastStoneWeightII(self, stones: List[int]) -> int:
|
||||
sumweight = sum(stones)
|
||||
target = sumweight // 2
|
||||
dp = [0] * 15001
|
||||
dp = [0] * (target + 1)
|
||||
for i in range(len(stones)):
|
||||
for j in range(target, stones[i] - 1, -1):
|
||||
dp[j] = max(dp[j], dp[j - stones[i]] + stones[i])
|
||||
|
Reference in New Issue
Block a user