Amazon interview program

What i wanted to do is suppose that we have to provide input number n to the program and it will gives us total number of occurrence / total number of ways.

E.g. n = 4
1+1+1+1 2+1+1 1+2+1 1+1+2 3+1 1+3 2+2
So total number of occurrence is 7.

program should have to display 7 as total occurrence. How do i have to compute it for any number?
start at the number and work down, try it on paper first

7

7 + 0
6 + 1
5 + 2
5 + 1 + 1
4 + 3
4 + 2 + 1
4 + 1 + 1 + 1
...
Topic archived. No new replies allowed.