Decode Ways
LeetCode 91 • Medium • Dynamic Programming
A message containing letters A–Z is mapped to 1–26. Count how many ways to decode a digit string. '0' is tricky: invalid alone unless part of 10 or 20.
TIMEO(n)
SPACEO(n)
Step 0/7
Ready
String "226".
dp[i] = ways to decode first i characters.