Skip to content

Commit

Permalink
Updata 494 优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Eumenides-K committed Nov 23, 2023
1 parent 6f262cc commit fe99dff
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions problems/0494.目标和.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,8 @@ class Solution {
// 初始化最上行(dp[0][j]),当nums[0] == j时(注意nums[0]和j都一定是大于等于零的,因此不需要判断等于-j时的情况),有唯一一种取法可取到j,dp[0][j]此时等于1
// 其他情况dp[0][j] = 0
// java整数数组默认初始值为0
for(int j = 0; j <= left; j++) {
if(nums[0] == j) {
dp[0][j] = 1;
}
if (nums[0] <= left) {
dp[0][nums[0]] = 1;
}

// 初始化最左列(dp[i][0])
Expand Down

0 comments on commit fe99dff

Please sign in to comment.