Dynamic Programming21 sections · 916 units
Open in Course

LeetCode 746 Min Cost Climbing Stairs - Problem Statement

Your first cost problem

You've seen how to count paths. Now I'll show you how to improve cost. In Min Cost Climbing Stairs (LeetCode 746746), each step has a cost[i] you pay when leaving it.

You can start at step 00 or 11, and climb 11 or 22 steps at a time. Goal: reach the top (past the last step) with minimum total cost. Example: cost = [10, 15, 20]. Starting at index 11 costs 1515, then jump 22 past the last step, total 1515. Starting at index 00 costs 1010, then step to index 22 costs 2020, total 3030. Best answer: 1515.