Hello, I'm given this problem:
- Implement a program in
Java to generate all of the unique positive partitions of a positive integer. Your program should print only those partitions containing at least one addend equal 1 (one).
Example with input 4:
I have found several solutions online that don't include checking for those solutions that include at least one addend equal to 1 and that is fine. My difficulty is trying to understand what exactly is going on within the algorithm to come up with the result.
This is the solutions I'm looking at:
I have gone through it by hand and get this result after the for-loop:
However, how does this result in this being displayed:
Also, after this how would I make sure that the results that don't include '1' aren't printed?
Any help will be greatly appreciated!