Good day,
My Data Structure teacher asked me to do a list of exercises, and one of the questions consists of writing a program to solve the numbers decomposition problem, for example:
If the user types the number 5:
5
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
I need to use the list data structure to do that, anyway my problem isn't with the data structure, my problem is with the algorithm. Does anyone know a simple way to do this?
Regards.