Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    Practice problems / Plus one

    Plus one

    Easyarraymath

    A large number is stored as an array of digits, most significant first ([1,2,3] = 123). Add one and return the new array.

    Example 1

    Input:  digits = [1,2,3]
    Output: [1,2,4]

    Example 2

    Input:  digits = [9]
    Output: [1,0]

    Constraints

    • 1 ≤ digits.length ≤ 100
    • No leading zeros except the number 0

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

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