This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = 6;
N = 3;
y = buildSumArray(x,N);
y2 = unique(y);
assert(isequal(round(sum(y)*100)/100,x))
assert(isequal(length(y),N))
assert(isequal(length(y2),N))
assert(sum(y == 0) == 0)
assert(isempty(y(y < 0)))
|
2 | Pass |
x = 13;
N = 5;
y = buildSumArray(x,N);
y2 = unique(y);
assert(isequal(round(sum(y)*100)/100,x))
assert(isequal(length(y),N))
assert(isequal(length(y2),N))
assert(sum(y == 0) == 0)
assert(isempty(y(y < 0)))
|
3 | Pass |
x = 78;
N = 11;
y = buildSumArray(x,N);
y2 = unique(y);
assert(isequal(round(sum(y)*100)/100,x))
assert(isequal(length(y),N))
assert(isequal(length(y2),N))
assert(sum(y == 0) == 0)
assert(isempty(y(y < 0)))
|
4 | Pass |
x = 2689;
N = 245;
y = buildSumArray(x,N);
y2 = unique(y);
assert(isequal(round(sum(y)*100)/100,x))
assert(isequal(length(y),N))
assert(isequal(length(y2),N))
assert(sum(y == 0) == 0)
assert(isempty(y(y < 0)))
|
17216 Solvers
Back to basics 23 - Triangular matrix
634 Solvers
3065 Solvers
07 - Common functions and indexing 1
338 Solvers
198 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!