I was given the following problem in an interview:
Given a staircase with N steps, you can go up with 1 or 2 steps each time. Output all possible way
Your solution sounds right.
S(n): If n = 1 return {1} If n = 2 return {2, (1,1)} Return S(n-1)x{1} U S(n-2)x{2}
(U is Union, x is Cartesian Product)
Memoizing this is trivial, and would make it O(Fib(n)).
O(Fib(n))