Hard · Backtracking
Decode Numbers
Given a string of digits, return every way to decode it into lowercase letters with the keys "1"→a through "26"→z (each key is one or two digits and none starts with 0), in any order — an empty list when no decoding exists.
Examples
Example 1
{
"digits": "12"
}Output: 2 decodings
Example 2
{
"digits": "226"
}Output: 3 decodings
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.