A message containing letters A-Z can be encoded as '1' to '26'. Given a string s of digits, return the number of ways to decode it.
Input: s = "12"
Output: 2
Explanation: 'AB' or 'L'.
Topics: dp
Asked by: Amazon, Google, Meta, Microsoft, Bloomberg
Time complexity: O(n). Space complexity: O(1).