I have a list of numbers (say, for example, {1,2,3,4,3,2,1,2,3,4,3,2}
), and I want to split it into sublists so that each sublist is the (smallest) sublist whose sum is larger than the preceding one. For the above example, my desired output is {{1},{2},{3},{4},{3,2},{1,2,3},{4,3},{2}}
(the sums are 1, 2, 3, 4, 5, 6, 7
, and the {2}
at the end just uses the remaining leftover elements).
Neither Split
nor SplitBy
seems to be able to do what I need. Is there a primitive to do this, or would someone care to invent a clever function?