Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

digits =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Backtrack choosing one letter for each digit.

Approach

Map digits to letters. DFS index i:

  • For each letter of digits[i], append to path and recurse.

Why it works

Cartesian product of letter sets per digit; backtracking enumerates all combinations.

Code
Loading...
Complexity
Time: O(4^n)
Space: O(n)
Solution
Updated: 2026-02-23

Idea

Backtrack choosing one letter for each digit.

Approach

Map digits to letters. DFS index i:

  • For each letter of digits[i], append to path and recurse.

Why it works

Cartesian product of letter sets per digit; backtracking enumerates all combinations.

Code
Loading...
Complexity
Time: O(4^n)
Space: O(n)