Cody

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

Solution 1449461

Submitted on 26 Feb 2018 by David Verrelli
• Size: 18
• This is the leading solution.
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)

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)

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)

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)

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!