implicit expansion is cool!! rip bsxfun :(
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [5 3 3 1 0 9 9 4 4 4 4 5 1 2 2];
r_correct = [1 1 2 1 1 1 2 1 2 3 4 2 2 1 2];
assert(isequal(run_length(x),r_correct))
2
ans =
2
|
2 | Pass |
x = ones(1,20);
r_correct = 1:20;
assert(isequal(run_length(x),r_correct))
3
ans =
3
|
3 | Pass |
x = [1 1 1 2 2 3 4 4 5 5 5];
r_correct = [1 2 3 1 2 1 1 2 1 2 3];
assert(isequal(run_length(x),r_correct))
4
ans =
4
|
4 | Pass |
x = 1:40;
r_correct = ones(size(x));
assert(isequal(run_length(x),r_correct))
5
ans =
5
|
5 | Pass |
x = [-34 -17*ones(1,100)];
r_correct = [1 1:100];
assert(isequal(run_length(x),r_correct))
|
2518 Solvers
Maximum running product for a string of numbers
816 Solvers
Remove the small words from a list of words.
474 Solvers
Create matrix of replicated elements
266 Solvers
Beat the test suite if you can :)
51 Solvers