Let n be a positive integer.
An integer partition of n is a sequence of positive integers in
non-increasing order that add up to n.
For example, (2, 2, 1, 1) is an integer partition of 6.
Write a recursive function that generates all integer partitions
of a given positive integer n.
For example, if n = 6, the function should generate:
(6)
(5, 1)
(4, 2)
(4, 1, 1)
(3, 3)
(3, 2, 1)
(3, 1, 1, 1)
(2, 2, 2)
(2, 2, 1, 1)
(2, 1, 1, 1, 1)
(1, 1, 1, 1, 1, 1)
The generated partitions should be stored in a 2-dimensional integer
array and that should be returned. Use the following function call:
int[][] generatePartitions(int n)