Find the minimum split costs adding up to sum less than K
for x in poss : NEW_LINE INDENT if ( K >= x ) : NEW_LINE INDENT ans += 1 NEW_LINE K -= x NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT return ans NEW_LINE