BinPacking.rb solution, changed method signature