Letter Combinations of a Phone Number
Updated
Problem statement
Digits 2 through 9 map to letters as on a telephone keypad. Return every string formed by choosing one mapped letter for each input digit.
Return an empty list for an empty input, and otherwise return combinations in lexicographic keypad order.
Function
letterCombinations(digits: String) → List<String>Examples
Example 1
digits = "23"return = ["ad","ae","af","bd","be","bf","cd","ce","cf"]Choose one of abc for 2 and one of def for 3.
Constraints
0 <= digits.length <= 8- Every character is between
2and9.
More LinkedIn Phone Screen questions
- Maximum Product of a Contiguous SubarrayPHONE SCREEN · Seen Nov 2026
- Maximum Sum of a Contiguous SubarrayPHONE SCREEN · Seen Nov 2026
- Merge Two Sorted ListsPHONE SCREEN · Seen Nov 2026
- Sqrt(x)PHONE SCREEN · Seen Nov 2026
- Total Years of Work ExperiencePHONE SCREEN · Seen Nov 2026
- Sum an Arbitrary-Dimensional ArrayPHONE SCREEN · Seen Oct 2026
- Known Words Matching Phone DigitsPHONE SCREEN · Seen Oct 2026
- Inverse-Depth Nested List SumPHONE SCREEN · Seen Oct 2026
- Valid Number with ExponentsPHONE SCREEN · Seen Oct 2026
- Sort a Quadratic-Transformed ArrayPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Largest Number Below N from Reusable DigitsByteDance · PHONE SCREENByteDance interview questions
- Phone-Number Letter CombinationsHeadway · PHONE SCREENHeadway interview questions
- String Permutations in Custom Character OrderWex · OA · PHONE SCREEN
- Numeric Poker OperationsRippling · PHONE SCREENRippling interview questions
- Unique String PermutationsAmazon · PHONE SCREEN
- Permutations of Unique CharactersSalesforce · PHONE SCREENSalesforce interview questions
- Count Prefix Paths in a Character GraphGoogle · PHONE SCREENGoogle interview questions
- Sorted Subsets of a StringMicrosoft · PHONE SCREENMicrosoft interview questions
- Maximum Unique Substring SplitThe Walt Disney Company · PHONE SCREENThe Walt Disney Company interview questions
- Letter Combinations of a Phone NumberBloomberg LP · PHONE SCREENBloomberg LP interview questions