Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    Practice problems / Min cost climbing stairs

    Min cost climbing stairs

    Easydynamic programmingarray

    cost[i] is the price of standing on step i. You may start on step 0 or 1, and from any step climb 1 or 2. Return the least cost to get past the last step.

    Example 1

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

    Start at 15 and climb 2.

    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

    Submit checks your solution against 8 tests, including hidden ones.

    /**
     * @param {int[]} cost
     * @return {int}
     */
    function minCostClimbingStairs(cost) {
      
    }
    
    Sign in to run
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.