Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Burst Balloons
Bookmark
Brute Force
Interval DP
Memoization
Input
Example 1
Example 2
Three Balloons
Sequential
All Same
Custom
nums
=
[3, 1, 5, 8]
balloons =
4
3
1
1
2
5
3
8
4
calls: 0
each burst pays left x self x right of the balloons still standing
balloons =
4
3
1
1
2
5
3
8
4
calls: 0
each burst pays left x self x right of the balloons still standing
balloons =
4
1
0
1
1
8
2
1
3
4
5
calls: 8 best: 0
1x1x8
=
8
coins for this burst
balloons =
4
1
0
1
1
1
2
3
4
5
calls: 15 best: 10
balloons =
4
1
0
5
1
1
2
3
4
5
calls: 23 best: 5
5
+
0
=
5
a new best here
balloons =
4
1
0
5
1
1
2
3
4
5
calls: 30 best: 0
burst
5
first
balloons =
4
1
0
1
1
8
2
1
3
4
5
calls: 37 best: 16
8
+
8
=
16
a new best here
balloons =
4
1
0
3
1
1
2
8
3
1
4
5
calls: 44 best: 56
24
+
32
=
56
a new best here
balloons =
4
1
0
5
1
1
2
3
4
5
calls: 51 best: 0
balloons =
4
1
0
3
1
1
2
3
4
5
calls: 59 best: 20
balloons =
4
1
0
3
1
3
1
2
1
5
3
2
8
4
4
1
5
calls: 65 best: 167
max coins =
167
= 15 + 120 + 24 + 8
algo
master
.
io
Step:
Burst every balloon. Each burst pays left x self x right of the balloons still standing
0 / 429
Input
Example 1
Example 2
Three Balloons
Sequential
All Same
Custom
nums
=
[3, 1, 5, 8]
0 / 429
algo
master
.
io
Step:
Burst every balloon. Each burst pays left x self x right of the balloons still standing