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)))
|
831 Solvers
238 Solvers
345 Solvers
583 Solvers
110 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!