Cody

Solution 933408

Submitted on 9 Aug 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
N=5;K=3; assert(isequal(num_sum(N,K),5))

2   Pass
N=7;K=4; assert(isequal(num_sum(N,K),11))

3   Pass
N=7;K=3; assert(isequal(num_sum(N,K),8))

4   Pass
N=15;K=6; assert(isequal(num_sum(N,K),110))

5   Pass
N=20;K=4; assert(isequal(num_sum(N,K),108))

6   Pass
N=12;K=9; assert(isequal(num_sum(N,K),73))

7   Pass
N=13;K=3; assert(isequal(num_sum(N,K),21))

8   Fail
N=12;K=2; assert(isequal(num_sum(N,K),7))

Error using vertcat Dimensions of matrices being concatenated are not consistent. Error in num_sum (line 4) y = histc(sum(unique(sort(reshape(filter('ca'-'b',1,find(vertcat(sparse(r,c,1), any(r.')))),K,'')).','rows'),2),N+K); Error in Test8 (line 2) assert(isequal(num_sum(N,K),7))

9   Fail
N=15;K=2; assert(isequal(num_sum(N,K),8))

Error using vertcat Dimensions of matrices being concatenated are not consistent. Error in num_sum (line 4) y = histc(sum(unique(sort(reshape(filter('ca'-'b',1,find(vertcat(sparse(r,c,1), any(r.')))),K,'')).','rows'),2),N+K); Error in Test9 (line 2) assert(isequal(num_sum(N,K),8))