I have encountered this interview puzzle and want to know its accurate answer.
You can generate 2^n different binary sequence of a n-bit number. Among these sequences the sequence having two 1's together will be considered as invalid else valid.
For example for N=3 sequences can be:
000 -> v
001 -> v
010 -> v
011 -> iv
100 -> v
101 -> v
110 -> iv
111 -> iv So output should be: 5
So formulate the strategy(hint provided to me: f(n) in terms of f(n-1)) which can tell number of valid sequences a N-bit number can have.