Tap here to switch tabs
Problem
Submissions

Problem: Min Cost Climbing Stairs

Min Cost Climbing Stairs gives stair costs; reach the top by paying for each stair you land on, moving one or two steps at a time, and starting from either of the first two stairs for free.

Statement

You are given an integer array, cost, where cost[i] represents the cost of stepping onto the ithi^{th} stair. After paying the cost of the stair you land on, you may climb either one or two steps forward. You may begin your climb from step 00 or step 11 without incurring any initial cost.

Return the minimum total cost required to reach the position just beyond the last stair (the “top”).

Constraints:

  • 2≤2 \leq cost.length ≤1000\leq 1000

  • 0≤0 \leq cost[i] ≤999\leq 999

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Min Cost Climbing Stairs

Min Cost Climbing Stairs gives stair costs; reach the top by paying for each stair you land on, moving one or two steps at a time, and starting from either of the first two stairs for free.

Statement

You are given an integer array, cost, where cost[i] represents the cost of stepping onto the ithi^{th} stair. After paying the cost of the stair you land on, you may climb either one or two steps forward. You may begin your climb from step 00 or step 11 without incurring any initial cost.

Return the minimum total cost required to reach the position just beyond the last stair (the “top”).

Constraints:

  • 2≤2 \leq cost.length ≤1000\leq 1000

  • 0≤0 \leq cost[i] ≤999\leq 999