K40

Letter Combinations of a Phone Number

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: ARRAY

Problem Statement & Objective

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent on a phone keypad.

Function Signature (Python)

letter_combinations(digits: str) -> list[str]

Input & Output Contract

Output Rule:Harf kombinasyonları listesi.

System Constraints

0 <= rakamlar.length <= 4
rakamlar yalnızca '2'-'9' arası karakterler içerir

Example Execution Walkthrough

rakamlar = '23' -> ['ad','ae','af','bd','be','bf','cd','ce','cf']

Example Test Scenarios (3)

Example 1
Input:["23"]
Expected Output:["ad","ae","af","bd","be","bf","cd","ce","cf"]
Example 2: Boş Girdi
Input:[""]
Expected Output:[]
Example 3: Tek Rakam
Input:["2"]
Expected Output:["a","b","c"]
Loading Python Editor...
Input Parameters
[
  "23"
]
Expected Output
[
  "ad",
  "ae",
  "af",
  "bd",
  "be",
  "bf",
  "cd",
  "ce",
  "cf"
]