Hi,
so I am sitting at home bored and I see this little
Java teaser on the net...
Write a number partitioner that partitions the number as follows for the number n where n can be any number:
eg. entered number is 4
4
3 1
2 2
2 1 1
1 1 1 1
basically breaking it down until you get to a print out of 1's equal to the sum of the entered number. It seems that you have to constantly take 1 away from the right most number in the list thats greater than 1 with the 1 that got taken away appended to the list. My idea is to use an arraylist to store the rows and wipe it for every row after printing out every value. It also looks like it will involve some recursion (which I am useless at). Any other pointers?
Thanks