Given the exact no. of elements that must be present in the array (let=r) and the max value of the last element of the array (let=n) find the total number of distinct non de
not for the added part: It boils down to the combinations with repetition allowed in non-descendign order. For n we have 0-n symbols (i.e. n+1 symbols) and r the length. With this in mid and this answer on math.stackexchange we get a simple formula: