MeetCode
Stars And Bars
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Run
Submit
Dark
Problem Statement
Solutions
Submissions
Stars And Bars
Hard
Computer Mathematics
Combinatorics
28 views
Explanation
Complexity
Problem Statement
Count solutions of x1+...+xk = n with xi>=0.
Input Format
Two integers n k.
Output Format
One integer.
Example
Input
4 3
Output
15
Constraints
n
Input / Output Format
Input Format
Two integers n k.
Output Format
One integer.
Constraints
n
Examples
Input:
4 3
Output:
15
Example Solution (Public)
Computer Mathematics
Number is C(n+k-1,k-1). Compute with nCr method.
Official Solution Code
Wrap
Copy
Number is C(n+k-1,k-1). Compute with nCr method.
Please
login
to submit solutions.
Editor
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Test Cases
Output
Submission Result
Input
4 3
Expected Output
15
Compile Output
Error
Output
Please
login
to submit solutions.