given the output from the first question write a algorithm to calculate how many possible inputs could have created that output. for example. "1211" could be interpreted as one two and one one || one hundred and twenty one ones.
Sigiloso
Consider number 1345792 Start from the reverse: When at digit 2: Given 2 there are 0 ways to interpret this. When at 9 : Just one way that is nine - two possible When at 7: We could either add 7 to all possibilities starting with 9 .. i.e it becomes 79 times 2 or we could do 7 times 9 followed by what we see by starting at 2. Thus the recurrence relation for digits at index 0 to digits at len-3 (we fill in last two digits manually) is this: f(i) = f(i+1) + f(i+2) This forms a Fibonacci sequence somehow. This for the example the output will be this: index 0 1 2 3 4 5 6 digit 1 3 3 5 7 9 2 f(i) 8 5 3 2 1 1 0 (Fill this from reverse) Thus when we start at digit 1 or index 0, we have 8 different ways to interpret this