← All problems
Decode Ways
A message is encoded by mapping 1->'A', 2->'B', ..., 26->'Z'. Given a digit string, count how many ways it can be decoded. Watch out for '0', which cannot stand alone.
Complexity
Time O(n), Space O(1)
Common pitfalls
- Treating '0' as standalone valid
- Missing the '10'/'20' pair case
Your solution
Log in to save your code and track progress.