Skip to content

Commit a3f55d9

Browse files
committed
Update solution 0494. Considering new edge test case.
1 parent e89003a commit a3f55d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

leetcode/0494.Target-Sum/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ There are 5 ways to assign symbols to make the sum of nums be target 3.
5252

5353
等号两边都加上 `sum(N) + sum(P)`,于是可以得到结果 `2 * sum(P) = target + sum(nums)`,那么这道题就转换成了,能否在数组中找到这样一个集合,和等于 `(target + sum(nums)) / 2`。那么这题就转化为了第 416 题了。`dp[i]` 中存储的是能使和为 `i` 的方法个数。
5454

55-
- 如果和不是偶数,即不能被 2 整除,那说明找不到满足题目要求的解了,直接输出 0
55+
- 如果和不是偶数,即不能被 2 整除,或者和是负数,那说明找不到满足题目要求的解了,直接输出 0
5656

5757
## 代码
5858

0 commit comments

Comments
 (0)