Find the first bin that can accommodate weight [ i ]
j = 0 NEW_LINE while ( j < res ) : NEW_LINE INDENT if ( bin_rem [ j ] >= weight [ i ] ) : NEW_LINE INDENT bin_rem [ j ] = bin_rem [ j ] - weight [ i ] NEW_LINE break NEW_LINE DEDENT j += 1 NEW_LINE DEDENT