0 XP · 0 scenes

Min Cost Climbing Stairs

EasyDP: cheapest cost to be standing on each level
Open on LeetCode ↗

1Try it yourself first

00:00

Think for 20-30 minutes before you open any hint. Being stuck is where the learning happens.

Only for you, saved in this browser. After you see the approach you will compare it with your idea.

2What is being asked

cost[i] is the price to step off stair i, and you then climb 1 or 2 stairs. You may start on stair 0 or 1. Find the cheapest way to reach the top (just beyond the last stair).

How to recognise itThe price to stand on a level = the cheaper of arriving from one below (paying that level's fee) or two below.

3Hint ladder

Take one rung at a time. Stop as soon as the idea clicks.

  1. Hint 1
  2. Hint 2

4The approach

Have you tried the hints? The approach is built as a path from the obvious way to the clever one.

✓After you finish

Confidence