Split array two array based on sum

Certified Lead Developer

Hi,

i have an array of numbers like this
{ 10, 5, 6, 9, 8, 11, 7, 4, 2, 13, 16, 1, 5 }
I want split this array in several arrays in wich the sum of all element must be maximum 20.
There is any snippet for doing this easily?
Thanks

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data