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 1 1 1 2];
assert(isequal(run_length(x),r_correct))
r =
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
2 | Pass |
x = ones(1,20);
r_correct = 1:20;
assert(isequal(run_length(x),r_correct))
r =
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
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))
r =
0 0 0 0 0 0 0 0 0 0 0
|
4 | Pass |
x = 1:40;
r_correct = ones(size(x));
assert(isequal(run_length(x),r_correct))
r =
Columns 1 through 30
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Columns 31 through 40
0 0 0 0 0 0 0 0 0 0
|
5 | Pass |
x = [-34 -17*ones(1,100)];
r_correct = [1 1:100];
assert(isequal(run_length(x),r_correct))
r =
Columns 1 through 30
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Columns 31 through 60
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Columns 61 through 90
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Columns 91 through 101
0 0 0 0 0 0 0 0 0 0 0
|
Replace NaNs with the number that appears to its left in the row.
1710 Solvers
Least common multiple of many numbers
159 Solvers
298 Solvers
Cell Counting: How Many Draws?
254 Solvers
502 Solvers