Cody

Solution 2066669

Submitted on 22 Dec 2019 by Asif Newaz
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
x = [0 0 1 1 1 0]; y_correct = [0 0 1 2 1 0]; assert(isequal(distancesFromHoles(x),y_correct))

x = 0 0 0 1 1 1 0 0 b = 1 2 3 7 8

2   Pass
x = [1 1 1 0 0 1 1 0 1 1 1 1 1 1 1]; y_correct = [1 2 1 0 0 1 1 0 1 2 3 4 3 2 1]; assert(isequal(distancesFromHoles(x),y_correct))

x = 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 0 b = 1 5 6 9 17

3   Pass
x = [ones(1,10),0,ones(1,10)]; y_correct = [1:5,5:-1:0,1:5,5:-1:1]; assert(isequal(distancesFromHoles(x),y_correct))

x = 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 b = 1 12 23

4   Pass
x = [1 1 1 0 0 0 0 0 0 0 0 0 1 1 1]; y_correct = [1 2 1 0 0 0 0 0 0 0 0 0 1 2 1]; assert(isequal(distancesFromHoles(x),y_correct))

x = 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 b = 1 5 6 7 8 9 10 11 12 13 17

5   Pass
x = ones(1,101); y_correct = [1:51,50:-1:1]; assert(isequal(distancesFromHoles(x),y_correct))

x = Columns 1 through 30 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 31 through 60 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 61 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 103 1 1 1 1 1 1 1 1 1 1 1 1 0 b = 1 103

6   Pass
x = [repmat([1,0],[1,50]),1]; y_correct = x; assert(isequal(distancesFromHoles(x),y_correct))

x = Columns 1 through 30 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Columns 31 through 60 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Columns 61 through 90 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Columns 91 through 103 0 1 0 1 0 1 0 1 0 1 0 1 0 b = Columns 1 through 30 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 Columns 31 through 52 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103

Suggested Problems