Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Partition Equal Subset Sum
Bookmark
Recursion
Memoization
Bottom-Up DP
Input
Example 1
Example 2
Example 3
Example 4
Custom
nums
=
[1, 5, 11, 5]
nums (index, remaining)
1
5
11
5
nums (index, remaining)
1
5
11
5
nums (index, remaining)
1
5
11
5
Look for a subset summing to 11
nums (index, remaining)
1
5
11
5
0,11
1,10
2,5
3,-6
3,5
4,0
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
Include 1 or skip it
nums (index, remaining)
1
5
11
5
0,11
1,10
2,5
3,-6
3,5
4,0
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
Include 5 or skip it
nums (index, remaining)
1
5
11
5
0,11
1,10
2,5
3,-6
3,5
4,0
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
Include 11 or skip it
nums (index, remaining)
1
5
11
5
0,11
1,10
2,5
3,-6
F
3,5
4,0
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
can_find(3, 5)
nums (index, remaining)
1
5
11
5
0,11
1,10
2,5
3,-6
F
3,5
4,0
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
can_find(4, 0)
nums (index, remaining)
1
5
11
5
0,11
1,10
2,5
3,-6
F
3,5
T
4,0
T
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
can_find(3, 5) is true
nums (index, remaining)
1
5
11
5
0,11
1,10
T
2,5
T
3,-6
F
3,5
T
4,0
T
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
can_find(1, 10) is true
nums (index, remaining)
1
5
11
5
0,11
T
1,10
T
2,5
T
3,-6
F
3,5
T
4,0
T
4,5
2,10
3,-1
3,10
4,5
4,10
1,11
2,6
3,-5
3,6
4,1
4,6
2,11
3,0
3,11
4,6
4,11
A subset sums to 11
algo
master
.
io
Step:
4 numbers. Split them into two groups with the same total, if possible.
0 / 19
Input
Example 1
Example 2
Example 3
Example 4
Custom
nums
=
[1, 5, 11, 5]
0 / 19
algo
master
.
io
Step:
4 numbers. Split them into two groups with the same total, if possible.