Skip to content
Advertisement

Tag: algorithm

Split a list into n sublists in all possible ways

I want to split a list into a given number n sublists in all possible ways in Java. For example [1, 2, 3, 4] where n = 3 would include the following lists (but would not be a complete solution – complete would require much more space): etc I adapted a solution from another similar question (Split a list into

Advertisement