Find the total number of distinct Non decreasing arrays possible

后端 未结 2 1552
囚心锁ツ
囚心锁ツ 2021-01-16 07:23

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

2条回答
  •  旧巷少年郎
    2021-01-16 08:10

    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:

    enter image description here

提交回复
热议问题