Cody

Problem 2948. Create an m x n array consisting only of an input value.

Solution 2617180

Submitted on 26 Jun 2020 by Bence Cseppento
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
m = 5; n = 4; x = 5; y_correct = [5 5 5 5; 5 5 5 5; 5 5 5 5; 5 5 5 5; 5 5 5 5] assert(isequal(array_x(m,n,x),y_correct));

y_correct = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ans = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5

2   Pass
m = 4; n = 3; x = -7; y_correct = [-7 -7 -7; -7 -7 -7; -7 -7 -7; -7 -7 -7] assert(isequal(array_x(m,n,x),y_correct));

y_correct = -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 ans = -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7 -7

3   Pass
m = 2; n = 6; x = 11; y_correct = [11 11 11 11 11 11; 11 11 11 11 11 11] assert(isequal(array_x(m,n,x),y_correct));

y_correct = 11 11 11 11 11 11 11 11 11 11 11 11 ans = 11 11 11 11 11 11 11 11 11 11 11 11

4   Pass
m = 8; n = 1; x = 42; y_correct = [42; 42; 42; 42; 42; 42; 42; 42] assert(isequal(array_x(m,n,x),y_correct));

y_correct = 42 42 42 42 42 42 42 42 ans = 42 42 42 42 42 42 42 42