In Basket Ball you can score 1 point, 2 points or 3 points in 1 shot. In you many ways can your score 50 points (or more generally n points) points?
1 point: 1 way (1)
2 points: 2 ways (2; 1-1)
3 points: 4 ways (3; 2-1; 1-2; 1-1-1)
4 points: 7 ways:
3-1
1-3
2-2
2-1-1
1-1-2
1-2-1
1-1-1-1
You just need to return the number of ways, you don't need the different ways.
I will post my solution in a few hours...
1 point: 1 way (1)
2 points: 2 ways (2; 1-1)
3 points: 4 ways (3; 2-1; 1-2; 1-1-1)
4 points: 7 ways:
3-1
1-3
2-2
2-1-1
1-1-2
1-2-1
1-1-1-1
You just need to return the number of ways, you don't need the different ways.
I will post my solution in a few hours...