put all possible values greater equal to prev
for i in range ( prev , left + 1 ) : NEW_LINE INDENT answer += calculate ( pos + 1 , i , left - i , k ) ; NEW_LINE DEDENT dp [ pos ] [ prev ] [ left ] = answer ; NEW_LINE return dp [ pos ] [ prev ] [ left ] ; NEW_LINE