Define = count of valid binary numbers from position onward, given the previous bit was . : the last placed bit was .
You can only place now. : the last placed bit was (or no bit yet). You can place or . Base case: when reaches the end, return . You've built a valid number. This state captures all the information needed to count valid binary numbers from position pos onward.