This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [1 0 1 1 0 0 1 0 0 1 1 1 1 0 0 0];
y_correct = [1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0];
assert(isequal(replace_pattern(x),y_correct))
|
2 | Pass |
x = [0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 0 1 0 0 1];
y_correct = [0 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1];
assert(isequal(replace_pattern(x),y_correct))
|
3 | Pass |
x = [ones(1,10); ones(1,10); zeros(1,10)];
x = x(:)';
y_correct = [ones(1,29) 0];
assert(isequal(replace_pattern(x),y_correct))
|
4 | Pass |
x = [1 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1 0 0 0 1];
y_correct = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1];
assert(isequal(replace_pattern(x),y_correct))
|
5 | Pass |
x = [ones(1,250) zeros(1,250), ones(1,250) zeros(1,250)];
y_correct = x;
x([3,35,67,100,103,201]) = 0;
x([257,301,333,404]) = 1;
x([505,606,616]) = 0;
x(997) = 1;
assert(isequal(replace_pattern(x),y_correct))
|
312 Solvers
317 Solvers
228 Solvers
367 Solvers
1222 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!