← ALL NOTES
String

91. Decode Ways

1D DP: dp[i] is the number of ways to decode the length-i prefix, and it depends on how the last one or two digits are read. A single digit decodes if it isn't '0' (codes 1–9). A pair decodes if it…

Loading…