Given two positive numbers n and k, where n>=k. In how many ways can we write n as sum of k positive numbers. Same numbers but different orders are considered different.
Example
For n=5, k=2 the answer is 4.
5 = 1 + 4
5 = 2 + 3
5 = 3 + 2
5 = 4 + 1
Solution Stats
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers26
Suggested Problems
-
Duplicate each element of a vector.
639 Solvers
-
Rotate input square matrix 90 degrees CCW without rot90
697 Solvers
-
Diagonal & Anti-Diagonal Matrix: Easy
97 Solvers
-
Is this triangle right-angled?
6787 Solvers
-
ベクトル [1 2 3 4 5 6 7 8 9 10] の作成
602 Solvers
More from this Author5
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
please correct the reference solution to com(x,k) instead of com(x)
Please correct test cases, the function should have 2 arguments.
Error message: Not enough input arguments.
The test suite has been corrected.