Cody

# Problem 42646. Matrix FUN

Solution 1972746

Submitted on 12 Oct 2019
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
x = 4; y_correct = 0; assert(isequal(mat_fun(x),y_correct))

y = 1

Assertion failed.

2   Fail
x = [3 2 3 2 5 6 2 1 2]; y_correct = 3; assert(isequal(mat_fun(x),y_correct))

y = 0 2 0 2 2 0 2 1 2

Assertion failed.

3   Fail
x = [999 999 999 2 15 6]; y_correct = 5; assert(isequal(mat_fun(x),y_correct))

y = 0 0 0 2 0 0

Assertion failed.

4   Fail
x = 3:3:999; y_correct = 333; assert(isequal(mat_fun(x),y_correct))

y = Columns 1 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 61 through 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 91 through 120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 121 through 150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 151 through 180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 181 through 210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 211 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 271 through 300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 301 through 330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 331 through 333 0 0 0

Assertion failed.

5   Fail
x = [1 2 3 4 5 6;6 5 4 3 2 1]; y_correct = 4; assert(isequal(mat_fun(x),y_correct))

y = 1 2 0 1 2 0 0 2 1 0 2 1

Assertion failed.

6   Fail
x = [7 8 11 13 14 17]; y_correct = 0; assert(isequal(mat_fun(x),y_correct))

y = 1 2 2 1 2 2

Assertion failed.