EliteProgrammersClub / EPCDailyChallenge

Daily challenge on algorithm, using different languages. From different problems to be solved.
MIT License
7 stars 20 forks source link

Array Chunk #8

Open xasterKies opened 2 years ago

xasterKies commented 2 years ago

Directions

Given an array and chunk size, divide the array into many where the subarray is of length size .Make use of functions and methods where necessory

You can code this with any language of you choice!

Examples

chunk([ 1, 2, 3, 4], 2) -----> [ [ 1, 2 ], [ 3, 4 ] ] chunk([ 1, 2, 3, 4, 5 ], 2) -----> [ [ 1, 2 ], [ 3, 4 ], [5] ] chunk([ 1, 2, 3, 4, 5, 6, 7, 8 ], 3) -----> [ [ 1, 2, 3], [ 4, 5, 6 ], [7, 8] ] chunk([ 1, 2, 3, 4, 5 ], 4) -----> [ [ 1, 2 , 3, 4 ], [5] ] chunk([ 1, 2, 3, 4, 5 ], 10) -----> [ 1, 2 , 3, 4, 5 ]

xxxSkypper commented 2 years ago

please assign me

Blanco237 commented 2 years ago

Assign me please

xasterKies commented 2 years ago

Done @Blanco237