Skip to content

Commit e89003a

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

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
@@ -63,7 +63,7 @@ func findTargetSumWays(nums []int, S int) int {
6363
for _, n := range nums {
6464
total += n
6565
}
66-
if S > total || (S+total)%2 == 1 {
66+
if S > total || (S+total)%2 == 1 || S+total < 0 {
6767
return 0
6868
}
6969
target := (S + total) / 2

0 commit comments

Comments
 (0)