DEV Community

Discussion on: Daily Challenge #104 - Matrixify

stanciudragosioan profile image
StanciuDragosIoan

Hi, the function should build columns, say you have only 9 indexes and build 3 columns:

Say array is [0,1,2,3,4,5,6,7,8]

Your columns will be:

0 3 6
1 4 7
2 5 8

That's the output in the console, of course the 'columns' can be simple arrays, but the elements have to be pushed onto them like this.

Also, if instead of 9 items you have say 11 -> [0,1,2,3,4,5,6,7,8,9,10], your output will be similar but the last column will be incomplete:

0 3 6 9
1 4 7 10
2 5 8

Hope this clarifies it a bit.

Thanks for reaching out =).