Hello, help me please. There is a list of nodes.
<list>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
and so on...
</list>
Need to divide the list of "n" (arbitrary number) equal parts.
If the number of nodes is not divided equally, then let the last set of nodes will contain the remainder of the division.
For example, if the input list contains 33 elements and the output should have 4 parts with uniformly distributed elements. At the exit to get 3 parts to 9 of elements and one part with 6 elements in the sum of 33.
input
<ul>
<li>1</li>
<li>2</li>
...
<li>33</li>
</ul>
Output
<ul>
<li>1</li>
<li>2</li>
...
<li>9</li>
</ul>
<ul>
<li>10</li>
<li>11</li>
...
<li>18</li>
</ul>
<ul>
<li>19</li>
<li>11</li>
...
<li>27</li>
</ul>
<ul>
<li>28</li>
<li>30</li>
...
<li>33</li>
</ul>
Divided into 4 cols.