Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    Practice problems / Days until a warmer day

    Days until a warmer day

    Mediumstackmonotonic stackarray

    For each day in temps, return how many days you must wait for a warmer one. If no warmer day follows, use 0.

    Example 1

    Input:  temps = [73,74,75,71,69,72,76,73]
    Output: [1,1,4,2,1,1,0,0]

    Example 2

    Input:  temps = [30,40,50,60]
    Output: [1,1,1,0]

    Constraints

    • 1 ≤ temps.length ≤ 10⁵
    • 30 ≤ temps[i] ≤ 100

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

    /**
     * @param {int[]} temps
     * @return {int[]}
     */
    function daysUntilWarmer(temps) {
      
    }
    
    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.