We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 93adea0 + 0ff840f commit a190dbeCopy full SHA for a190dbe
leetcode/0494.Target-Sum/494. Target Sum.go
@@ -6,7 +6,7 @@ func findTargetSumWays(nums []int, S int) int {
6
for _, n := range nums {
7
total += n
8
}
9
- if S > total || (S+total)%2 == 1 || S+total < 0 {
+ if S+total < 0 || S > total || (S+total)%2 == 1 {
10
return 0
11
12
target := (S + total) / 2
0 commit comments