41. Decode Message
Easy
A message was converted into digits, using 1 for A, 2 for B up to 26 for Z. Given the string digitos, return how many valid decodings exist. A zero may appear only as part of 10 or 20; if there is no valid decoding, return 0.
Example 1
Input: digitos = "121"
Output: 3
Explanation: It can represent ABA, AU, or LA.
Example 2
Input: digitos = "226"
Output: 3
Constraints
- 1 <= digitos.length <= 100
- digitos contains only characters from 0 to 9
Dynamic programmingStrings
Saved in this browser
Caso 1
digitos =
"121"
Expected =
3
Caso 2
digitos =
"226"
Expected =
3
Run checks these 2 cases. Submit runs all 7, including hidden ones.