106: Decode ways

Given a string of numbers, return the number of ways to decode this string

Numbers have the following mapping

1 -> A
2 -> B
3 -> C
...
26 -> Z

 

Example 1

Input:   "14"

Output:  2

Explanation: AB = 1 4 and N = 14

Example 2

Input:   "103"

Output:  1

Explanation: JC = 10 3

Difficulty:Medium
Topic:Dynamic programming
Problem #:106