Given a positive integer, X, write code to generate all the possible partitions. A partition is simply a list of (positive) integers that will sum up to X.
For example, if X=3, then your code should return the following partitions: [1,1,1], [1,2], . Additionally, note that the order does not matter (meaning [1,2] and [2,1] would be considered the same in our example).
Subscribe to premium account to see the solution.Get premium now