Cody

Solution 1517795

Submitted on 5 May 2018 by Jacob Lavzin
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
filetext = fileread('diagonalPattern.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
n = 1; mat_correct = 0; assert(isequal(diagonalPattern(n),mat_correct))

mat = 1 mat = 0

3   Pass
n = -1; mat_correct = []; assert(isequal(diagonalPattern(n),mat_correct))

mat = []

4   Pass
n = 1.5; mat_correct = []; assert(isequal(diagonalPattern(n),mat_correct))

mat = []

5   Pass
n = 4; mat_correct = [0 1 2 3 1 0 1 2 2 1 0 1 3 2 1 0]; assert(isequal(diagonalPattern(n),mat_correct))

mat = 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 mat = 0 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 mat = 0 1 3 13 5 11 10 8 9 7 6 12 4 14 15 1 mat = 0 1 2 13 5 11 10 8 9 7 6 12 4 14 15 1 mat = 0 1 2 3 5 11 10 8 9 7 6 12 4 14 15 1 mat = 0 1 2 3 1 11 10 8 9 7 6 12 4 14 15 1 mat = 0 1 2 3 1 0 10 8 9 7 6 12 4 14 15 1 mat = 0 1 2 3 1 0 1 8 9 7 6 12 4 14 15 1 mat = 0 1 2 3 1 0 1 2 9 7 6 12 4 14 15 1 mat = 0 1 2 3 1 0 1 2 2 7 6 12 4 14 15 1 mat = 0 1 2 3 1 0 1 2 2 1 6 12 4 14 15 1 mat = 0 1 2 3 1 0 1 2 2 1 0 12 4 14 15 1 mat = 0 1 2 3 1 0 1 2 2 1 0 1 4 14 15 1 mat = 0 1 2 3 1 0 1 2 2 1 0 1 3 14 15 1 mat = 0 1 2 3 1 0 1 2 2 1 0 1 3 2 15 1 mat = 0 1 2 3 1 0 1 2 2 1 0 1 3 2 1 1 mat = 0 1 2 3 1 0 1 2 2 1 0 1 3 2 1 0

6   Pass
n = 5; mat_correct = [0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 4 3 2 1 0]; assert(isequal(diagonalPattern(n),mat_correct))

mat = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 6 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 13 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 20 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 22 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 10 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 12 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 19 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 21 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 3 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 11 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 4 18 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 4 3 25 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 4 3 2 2 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 4 3 2 1 9 mat = 0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 4 3 2 1 0