Skip to the editor
JSGroundwork
JSGroundwork handwritten · web dev
←Back to Backtracking

Ready to read

JSJavaScript⑂Git◎Interview prepΣDSA in JSSDSystem Design
More topics15›
</>HTML{ }CSS⚛ReactNNext.jsNeNest.jsTSTypeScriptNoNode.js🐳DockerDBSQL & Databases✓Testing🔒Web Security☁Cloud & DevOps◈GraphQL◆Redis☸Kubernetes
☰‹›
Description
All topics›JavaScript›Backtracking

Letter Combinations of a Phone Number

intermediatelayer I6 · Backtracking5 tests

Given a string of digits 2–9, return every letter combination the number could spell on an old telephone keypad.

  • 2=abc, 3=def, 4=ghi, 5=jkl, 6=mno, 7=pqrs, 8=tuv, 9=wxyz
  • Every combination has exactly one letter per digit, in the digits' own order
  • The combinations may be returned in any order
  • An empty input returns an empty array — not an array holding the empty string

Stuck?

All exercisesPlayground
1234567891011121314
loading the editor…

Nothing yet — hit Run and whatever you log shows up here.

Submit to see how you did.

⌘/Ctrl + Enter run⌘/Ctrl + S save⌘/Ctrl + / comment⌘/Ctrl + F find/replace⌘/Ctrl + D select next matchAlt + click multi-cursorTab indent · ⇧Tab outdentEsc leave fullscreen