Cody

# Problem 44531. 2) Are you more familiar with iteration methods or Linear Algebra ? Let's see together.

Solution 1451341

Submitted on 27 Feb 2018 by Jiahang Li
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
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)))

ans = 2.0000 2.0000 2.0000

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)))

ans = 2.6000 2.6000 2.6000 2.6000 2.6000

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)))

ans = 7.0909 7.0909 7.0909 7.0909 7.0909 7.0909 7.0909 7.0909 7.0909 7.0909 7.0909

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)))

ans = Columns 1 through 17 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 18 through 34 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 35 through 51 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 52 through 68 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 69 through 85 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 86 through 102 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 103 through 119 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 120 through 136 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 137 through 153 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 154 through 170 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 171 through 187 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 188 through 204 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 205 through 221 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 222 through 238 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 Columns 239 through 245 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755 10.9755