Sign In
You are coding as a Guest. Sign in with your RoleNest account to permanently track your streak, earn XP, and climb the Campus Leaderboard!
Sign In with RoleNest
🔥Min Cost Climbing Stairs: Dual Step OptimizationEasy
DAILY PROBLEM OF THE DAY+50 XP • Daily Streak

Solve today's challenge or tackle one of the 3 Super Hard challenges for +150 XP.

EasyDynamic Programming•Acceptance: 65.8%

Min Cost Climbing Stairs: Dual Step Optimization

Targeted in FAANG & Tech OA:AmazonMicrosoft
Real-World Engineering Context
Underpins energy minimization routes in robotic leg kinematics and network hop battery consumption budgeting.
You are given an integer array `cost` where `cost[i]` is the cost of `i`th step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the step with index `0`, or the step with index `1`. Return the minimum cost to reach the top of the floor (past index `n - 1`).

Sample Test Cases

Input: [[10,15,20]]
Expected: 15
Input: [[1,100,1,1,1,100,1,1,100,1]]
Expected: 6
Input: [[0,0]]
Expected: 0

Constraints

  • 2 <= cost.length <= 1000
  • 0 <= cost[i] <= 999
Recruiter Fast-Track ReferralVerified Candidate
Direct pipeline to Google, Amazon, Microsoft, Swiggy, & Uber recruiters
DevScore: 750/1000

Top DevScore profiles bypass resume screening filters. Every verified problem solve writes authentic proof-of-work to your profile and dispatches you directly into employer inboxes on RoleNest.