Coding Challenge

Decode Ways

Medium
dynamic-programmingstring

Count how many ways a digit string can be decoded.

Digits map to letters 1 -> A through 26 -> Z. Return how many valid decodings exist for the given digit string.

Examples

Input: s = "226"

Output: 3

Constraints

  • 1 <= s.length
  • String may contain zeros

Preparing your coding workspace...