Limited time: AI code review, hints, mock interviews, whiteboard analysis, and all Pro features are unlocked. Enroll

Min Cost Climbing Stairs

Easy

Topics
ArrayDynamic Programming

Given an array cost where cost[i] is the cost of step i, you can climb 1 or 2 steps and start from index 0 or 1. Return the minimum cost to reach the top (just past the last step).

Example 1

Input:  cost = [10,15,20]
Output: 15

Example 2

Input:  cost = [1,100,1,1,1,100,1,1,100,1]
Output: 6

Constraints

  • 2 <= cost.length <= 1000
  • 0 <= cost[i] <= 999
Run ⌘' · Submit ⌘⏎
SensAI SensAI
Beta
Listening...
Tap mic to stop voice mode

Unlock AI Features

One click to activate - no payment, no credit card. Just sign in and you're in.

AI code review and hints
SensAI chat assistant
AI mock interviews
Whiteboard analysis
100% free during early access