Skip to content

Number of distinct arrays #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hamidgasmi opened this issue Aug 7, 2020 · 0 comments
Open

Number of distinct arrays #262

hamidgasmi opened this issue Aug 7, 2020 · 0 comments
Assignees
Labels

Comments

@hamidgasmi
Copy link
Owner

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.
@hamidgasmi hamidgasmi self-assigned this Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant