Quant Memo
Coding/●●●●●

How many ways to decode a trade-ticket code

A ticketing system encodes each order type as a number 1..26 (A=1, ..., Z=26) and concatenates the digits with no separators. Given the raw digit string, count how many distinct decodings are possible.

"226" -> 3      # "2 2 6" (BBF), "22 6" (VF), "2 26" (BZ)
"06"  -> 0      # no code starts with 0

Return the number of valid decodings. A 0 can only appear as the second digit of 10 or 20.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions