Cody

# Problem 1853. Enlarge array

Solution 2143064

Submitted on 27 Feb 2020
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   Fail
A = randi(100); sz = [randi(100) 1]; B_correct = repmat(A,sz); assert(isequal(enlarge(A,sz),B_correct))

ans = 1×1 cell array {30×1 double}

Output argument "B" (and maybe others) not assigned during call to "enlarge". Error in Test1 (line 4) assert(isequal(enlarge(A,sz),B_correct))

2   Fail
A = randi(1000); sz = [1 randi(1000)]; B_correct = repmat(A,sz); assert(isequal(enlarge(A,sz),B_correct))

ans = 1×1 cell array {1×403 double}

Output argument "B" (and maybe others) not assigned during call to "enlarge". Error in Test2 (line 4) assert(isequal(enlarge(A,sz),B_correct))

3   Fail
A = eye(3); sz = [2 4]; B_correct = [1 1 1 1 0 0 0 0 0 0 0 0; 1 1 1 1 0 0 0 0 0 0 0 0; 0 0 0 0 1 1 1 1 0 0 0 0; 0 0 0 0 1 1 1 1 0 0 0 0; 0 0 0 0 0 0 0 0 1 1 1 1; 0 0 0 0 0 0 0 0 1 1 1 1]; assert(isequal(enlarge(A,sz),B_correct))

ans = 3×3 cell array {2×4 double} {2×4 double} {2×4 double} {2×4 double} {2×4 double} {2×4 double} {2×4 double} {2×4 double} {2×4 double}

Output argument "B" (and maybe others) not assigned during call to "enlarge". Error in Test3 (line 9) assert(isequal(enlarge(A,sz),B_correct))

4   Fail
A = magic(4); sz = [3 3]; B_correct = [16 16 16 2 2 2 3 3 3 13 13 13; 16 16 16 2 2 2 3 3 3 13 13 13; 16 16 16 2 2 2 3 3 3 13 13 13; 5 5 5 11 11 11 10 10 10 8 8 8; 5 5 5 11 11 11 10 10 10 8 8 8; 5 5 5 11 11 11 10 10 10 8 8 8; 9 9 9 7 7 7 6 6 6 12 12 12; 9 9 9 7 7 7 6 6 6 12 12 12; 9 9 9 7 7 7 6 6 6 12 12 12; 4 4 4 14 14 14 15 15 15 1 1 1; 4 4 4 14 14 14 15 15 15 1 1 1; 4 4 4 14 14 14 15 15 15 1 1 1]; assert(isequal(enlarge(A,sz),B_correct))

ans = 4×4 cell array {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double} {3×3 double}

Output argument "B" (and maybe others) not assigned during call to "enlarge". Error in Test4 (line 15) assert(isequal(enlarge(A,sz),B_correct))

5   Fail
A = (-99:0)'; sz = [1 100]; B = enlarge(A,sz); assert(all(all(bsxfun(@minus,B,A)==0)))

ans = 100×1 cell array {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double} {1×100 double}

Output argument "B" (and maybe others) not assigned during call to "enlarge". Error in Test5 (line 3) B = enlarge(A,sz);