On a page there’re 3 columns. And I have a list of objects. Every object should go one of the 3 columns in the subsequent order.
1 -> 1, 2 -> 2, 3 -> 3, 4 -> 1, 5 -> 2 and so on.
I’m trying to come up with an algorithm and have difficult to do so.
What’s the best way to do so? A high-level pointer will be fine.
of put that simply: split a list into N sub-lists. The 1st sub-list might be bigger than the rest.
If I have 7 elements and I want to split them into N = 3 sub-lists, there should be created 3 sublists:
[[3 elements], [2 elements], [2 elements]]
Namely, I want to preserve all the elements. Enum.chunk_every(…, :discard) won’t work.