Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
y_correct = [3 2 2 2 3 4; 3 2 1 2 3 4; ...
3 2 2 2 3 4; 3 3 3 3 3 4; 4 4 4 4 4 4; ...
5 5 5 5 5 5];
assert(isequal(safety_map(6,2,3),y_correct))
ans =
3 2 2 2 3 4
3 2 1 2 3 4
3 2 2 2 3 4
3 3 3 3 3 4
4 4 4 4 4 4
5 5 5 5 5 5
|
2 | Pass |
y_correct = [2 2;2 1];
assert(isequal(safety_map(2,2,2),y_correct))
ans =
2 2
2 1
|
3 | Pass |
y_correct = [9 8 7 6 5 4 3 2 1 2; ...
9 8 7 6 5 4 3 2 2 2; 9 8 7 6 5 4 3 3 3 3; ...
9 8 7 6 5 4 4 4 4 4; 9 8 7 6 5 5 5 5 5 5; ...
9 8 7 6 6 6 6 6 6 6; 9 8 7 7 7 7 7 7 7 7; ...
9 8 8 8 8 8 8 8 8 8; 9 9 9 9 9 9 9 9 9 9; ...
10 10 10 10 10 10 10 10 10 10];
assert(isequal(safety_map(10,1,9),y_correct))
ans =
9 8 7 6 5 4 3 2 1 2
9 8 7 6 5 4 3 2 2 2
9 8 7 6 5 4 3 3 3 3
9 8 7 6 5 4 4 4 4 4
9 8 7 6 5 5 5 5 5 5
9 8 7 6 6 6 6 6 6 6
9 8 7 7 7 7 7 7 7 7
9 8 8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9 9
10 10 10 10 10 10 10 10 10 10
|
4 | Pass |
y_correct = 1;
assert(isequal(safety_map(1,1,1),y_correct))
ans =
1
|
5 | Pass |
y_correct = [4 3 2 2; ...
4 3 2 1; 4 3 2 2; 4 3 3 3];
assert(isequal(safety_map(4,2,4),y_correct))
ans =
4 3 2 2
4 3 2 1
4 3 2 2
4 3 3 3
|
6 | Pass |
y_correct = [2 1;2 2];
assert(isequal(safety_map(2,1,2),y_correct))
ans =
2 1
2 2
|
7 | Pass |
y_correct = [4 4 4 4 4 4 4; 4 3 3 3 3 3 4; ...
4 3 2 2 2 3 4; 4 3 2 1 2 3 4; 4 3 2 2 2 3 4; ...
4 3 3 3 3 3 4; 4 4 4 4 4 4 4];
assert(isequal(safety_map(7,4,4),y_correct))
ans =
4 4 4 4 4 4 4
4 3 3 3 3 3 4
4 3 2 2 2 3 4
4 3 2 1 2 3 4
4 3 2 2 2 3 4
4 3 3 3 3 3 4
4 4 4 4 4 4 4
|
8 | Pass |
y_correct = [10 10 10 10 10 10 10 10 10 10; ...
10 9 9 9 9 9 9 9 9 9; 10 9 8 8 8 8 8 8 8 8; ...
10 9 8 7 7 7 7 7 7 7; 10 9 8 7 6 6 6 6 6 6; ...
10 9 8 7 6 5 5 5 5 5; 10 9 8 7 6 5 4 4 4 4; ...
10 9 8 7 6 5 4 3 3 3; 10 9 8 7 6 5 4 3 2 2; ...
10 9 8 7 6 5 4 3 2 1];
assert(isequal(safety_map(10,10,10),y_correct))
ans =
10 10 10 10 10 10 10 10 10 10
10 9 9 9 9 9 9 9 9 9
10 9 8 8 8 8 8 8 8 8
10 9 8 7 7 7 7 7 7 7
10 9 8 7 6 6 6 6 6 6
10 9 8 7 6 5 5 5 5 5
10 9 8 7 6 5 4 4 4 4
10 9 8 7 6 5 4 3 3 3
10 9 8 7 6 5 4 3 2 2
10 9 8 7 6 5 4 3 2 1
|
9 | Pass |
y_correct = [3 3 3; 2 2 3; 1 2 3];
assert(isequal(safety_map(3,3,1),y_correct))
ans =
3 3 3
2 2 3
1 2 3
|
10 | Pass |
y_correct = [2 1 2; 2 2 2; 3 3 3];
assert(isequal(safety_map(3,1,2),y_correct))
ans =
2 1 2
2 2 2
3 3 3
|
1900 Solvers
Project Euler: Problem 3, Largest prime factor
379 Solvers
Matrix indexing with two vectors of indices
485 Solvers
664 Solvers
Find an optimal placement of coolers on a grid
21 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!