Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Min Cost Climbing Stairs
Bookmark
Input
Example 1
Example 2
Zeros
Increasing
Two steps
Custom
cost
=
[1, 100, 1, 1, 1, 100, 1, 1, 100, 1]
0
1
2
3
4
5
6
7
8
9
top
1
?
100
?
1
?
1
?
1
?
100
?
1
?
1
?
100
?
1
?
?
dp[i] = min(dp[i-1] + cost[i-1], dp[i-2] + cost[i-2])
algo
master
.
io
Step:
Start: find the minimum cost to reach the top of 10 stairs
0 / 21
Input
Example 1
Example 2
Zeros
Increasing
Two steps
Custom
cost
=
[1, 100, 1, 1, 1, 100, 1, 1, 100, 1]
0 / 21
0
1
2
3
4
5
6
7
8
9
top
1
?
100
?
1
?
1
?
1
?
100
?
1
?
1
?
100
?
1
?
?
dp[i] = min(dp[i-1] + cost[i-1], dp[i-2] + cost[i-2])
algo
master
.
io
Step:
Start: find the minimum cost to reach the top of 10 stairs