Skip to content

Number of distinct arrays #262

Open
Open
@hamidgasmi

Description

@hamidgasmi

Given a sum of positive integers S and a their number n, find the number of distinct arrays under these conditions:

  • In each array, there are n elements whose sum is equal to S.

  • In each array, each element should be greater than or equal to the element on its left.

  • The elements formed in each array are distinct

  • E.g. 1.:

    • Inputs: S = 8 n = 4
    • Output: 5
    • Explanation: [1,1,1,5], [1,1,2,4], [1,1,3,3], [1,2,2,3], [2,2,2,2]
    • Each array has 4 (n) elements a sum of 8 (S) with each element on the left <= element on the right. There are 5 possible distinct options.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions