Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    Practice problems / Phone number letters

    Phone number letters

    Mediumbacktrackingstringhash map

    As on old phone keypads: 2=abc, 3=def, 4=ghi, 5=jkl, 6=mno, 7=pqrs, 8=tuv, 9=wxyz. Return every string digits could type. Return [] for empty digits. Order doesn't matter.

    Example 1

    Input:  digits = "23"
    Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]

    Example 2

    Input:  digits = ""
    Output: []

    Constraints

    • 0 ≤ digits.length ≤ 4
    • digits[i] is 2–9

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

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