As reported: Salesforce SMTS loop (Dec 2025), tech round 1 (60 minutes), the second of two questions after the zigzag string.
This is LeetCode 17 — Letter Combinations of a Phone Number.
Each digit 2–9 on a phone keypad maps to letters (2 → abc, 3 → def, 4 → ghi, 5 → jkl, 6 → mno, 7 → pqrs, 8 → tuv, 9 → wxyz). Given a string digits, return all letter strings it could represent, in any order. An empty input gives an empty list.
Example 1
digits = "23"
Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]
Example 2
digits = ""
Output: []
Example 3
digits = "2"
Output: ["a","b","c"]
Constraints: 0 ≤ digits.length ≤ 4; each digit is in '2'–'9'.
Code runner format: one line: digits as a JSON string. Implement letterCombinations(digits); the harness sorts your list before printing it.