Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 27ba94b

Browse files
优化
1 parent 88750b1 commit 27ba94b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎problems/1049.最后一块石头的重量II.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class Solution:
224224
def lastStoneWeightII(self, stones: List[int]) -> int:
225225
sumweight = sum(stones)
226226
target = sumweight // 2
227-
dp = [0] * 15001
227+
dp = [0] * (target +1)
228228
for i in range(len(stones)):
229229
for j in range(target, stones[i] - 1, -1):
230230
dp[j] = max(dp[j], dp[j - stones[i]] + stones[i])

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /