Min Cost Climbing Stairs
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given an array cost where cost[i] is the price of standing on step i of a staircase. After paying for a step you may climb either one or two steps.
You may start on step 0 or step 1 for free (you still pay the cost of the step you stand on). The top of the staircase is the position just past the last step, index cost.length, and it costs nothing.
Return the minimum total cost to reach the top.
Examples
Constraints
- 2 <= cost.length <= 1000
- 0 <= cost[i] <= 999
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.