Given a string s
containing only digits, return the number of ways it can be decoded according to:
'A' -> "1"
'B' -> "2"
...
'Z' -> "26"
Rules:
Constraints:
Examples:
// Example 1:
console.log(numDecodings("12"));
// Output: 2
// Explanation: Two ways to decode:
// - 1,2 -> "AB"
// - 12 -> "L"
// Example 2:
console.log(numDecodings("01"));
// Output: 0
// Explanation: Leading zero makes this invalid