group-desc
v1.0.0
Published
Split a sequence into N groups, each is not longer than the previous
Downloads
3
Readme
group-desc
Split a sequence into N groups, each is not longer than the previous
usage
$ npm install group-desc --save
var groupDesc = require('group-desc').groupDesc;
groupDesc([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 3)
//[
//[ [ 0, 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ],
//[ [ 0, 1, 2, 3 ], [ 4, 5, 6, 7 ], [ 8, 9 ] ],
//[ [ 0, 1, 2, 3, 4 ], [ 5, 6, 7 ], [ 8, 9 ] ],
//[ [ 0, 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9 ] ],
//[ [ 0, 1, 2, 3, 4, 5 ], [ 6, 7 ], [ 8, 9 ] ],
//[ [ 0, 1, 2, 3, 4, 5 ], [ 6, 7, 8 ], [ 9 ] ],
//[ [ 0, 1, 2, 3, 4, 5, 6 ], [ 7, 8 ], [ 9 ] ],
//[ [ 0, 1, 2, 3, 4, 5, 6, 7 ], [ 8 ], [ 9 ] ]
//]
author
license
Apache License Version 2.0