Backtracking pattern
Letter Combinations of a Phone Number
Given a string of digits 2 to 9, return all letter combinations the number could spell using the classic phone keypad mapping (2→abc, 3→def, …). Return them in any order. Watch it run step by step, then write your own pseudocode and get it checked by AI.
- LeetCode 17
- Medium
- 1 approach
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.
BacktrackingLeetCode 17
Medium
The approach
- 01 Backtracking · one digit per level O(4ⁿ · n)O(n) space
What you will learn
- How to read Letter Combinations of a Phone Number and spot the backtracking pattern in it
- Backtracking · one digit per level: O(4ⁿ · n) time, O(n) space
- The pseudocode for each approach, its line lit as the animation runs
- Practice: write your own pseudocode and get it checked
More Backtracking
See Letter Combinations of a Phone Number run, step by step
Sign in and this page opens on the animation, with all 8 Backtracking problems beside it.
DSA comes with the all labs plan and every ChaiCode batch.