CT047

Decode String Ways

MediumAcceptance: 0.0%

Given the mapping a=1, b=2, ..., z=26, and an encoded message (a string of digits), count the number of ways it can be decoded. The message is always decodable (no leading zeros that invalidate). Output the count.

Example 1:

Input: 111
Output: 3

Example 2:

Input: 123
Output: 3

Constraints:

1 <= len(message) <= 100 Message contains only digits

Tags:

dynamic-programming strings recursion
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki