title: Dividing an array into equally weighted subarrays
body: <p>Algorithm question here.</p>
  
  <p>I have an unordered array containing product weights, e.g. <code>[3, 2, 5, 5, 8]</code> which need to be divided up into smaller arrays.</p>
  
  <p>Rules:</p>
  
  <ul>
  <li><strong>REQUIRED</strong>: Should return 1 or more arrays.</li>
  <li><strong>REQUIRED</strong>: No array should sum to more than 12.</li>
  <li><strong>REQUIRED</strong>: Return minimum possible number of arrays, ex. total weight of example above is 23, which can fit into two arrays.</li>
  <li><strong>IDEALLY</strong>: Arrays should be weighted as evenly as possible.</li>
  </ul>
  
  <p>In the example above, the ideal return would be <code>[ [3, 8], [2, 5, 5] ]</code></p>
  
  <p>My current thoughts:</p>
  
  <ul>
  <li>Number of arrays to return will be <code>(sum(input_array) / 12).ceil</code></li>
  <li>A <a href="http://whatis.techtarget.com/definition/greedy-algorithm" rel="nofollow">greedy algorithm</a> could work well enough?</li>
  </ul>