Build all partitions into intervals.
all_partitions(n, kmax = n)
n | integer, sequence lenght to choose from. |
---|---|
kmax | int, maximum number of segments in solution. |
list of all partitions.
all_partitions(4, 2)#> [[1]] #> [1] 1 5 #> #> [[2]] #> [1] 1 2 5 #> #> [[3]] #> [1] 1 3 5 #> #> [[4]] #> [1] 1 4 5 #>