Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Target Sum
Bookmark
Input
Example 1
Example 2
Example 3
Example 4
Custom
nums
=
[1, 1, 1, 1, 1]
,
target
=
3
nums
±
1
±
1
±
1
±
1
±
1
target =
3
put + or - before every num, how many ways to reach 3?
algo
master
.
io
Step:
Assign + or - to every num so the expression evaluates to 3. Count the ways.
0 / 49
Input
Example 1
Example 2
Example 3
Example 4
Custom
nums
=
[1, 1, 1, 1, 1]
,
target
=
3
0 / 49
nums
±
1
±
1
±
1
±
1
±
1
target =
3
put + or - before every num, how many ways to reach 3?
algo
master
.
io
Step:
Assign + or - to every num so the expression evaluates to 3. Count the ways.