Let T(n) be the number of possible sequences of 1's and 2's having sum 'n',
Now we will divide these sequences into 2 cases: Sequences starting with 1 and starting with 2.
if a sequence of 1's and 2's having sum 'n' starts with 1 then, our problem reduces to finding the sequences of 1's and 2's with sum n-1, which is T(n-1).
similarly, if a sequence starts with 2, our problem reduces to T(n-2).
Hence T(n)= T(n-1) + T(n-2), where T(1)=1, T(2)=2.