Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','locOf5.m')
|
2 | Pass |
x = 2:2:20;
y_correct = 0;
assert(isequal(locOf5(x),y_correct))
row =
1
col =
10
y =
1×0 empty double row vector
y =
0
|
3 | Pass |
x = rot90(1:10);
y_correct = 6;
assert(isequal(locOf5(x),y_correct))
row =
10
col =
1
y =
0
y =
6
i =
2
|
4 | Pass |
x = [1 2 5
5 9 1
5 6 5];
y_correct = [2 0 1];
assert(isequal(locOf5(x),y_correct))
row =
3
col =
3
y =
0 0 0
y =
2 0 0
i =
2
j =
1
y =
2 0 1
i =
4
|
5 | Pass |
x = magic(5);
y_correct = [0 2 0 0 0];
assert(isequal(locOf5(x),y_correct))
row =
5
col =
5
y =
0 0 0 0 0
y =
0 2 0 0 0
i =
3
j =
1
|
6 | Pass |
x = [1 2 3 4 5;
5 4 3 2 1
2 3 5 2 1
1 5 2 6 8
3 5 2 2 5];
y_correct = [2 4 3 0 1];
assert(isequal(locOf5(x),y_correct))
% %%
% x = randi([-10,10],20,1e6);
% x(x==5) = 0;
% p = sort(randi([0 size(x,1)],5,size(x,2)));
% y_correct = p(1,:);
% p(2:end,~y_correct) = 0;
% [~,col,v] = find(p);
% x((col-1)*size(x,1)+v) = 5;
% assert(isequal(locOf5(x),y_correct))
row =
5
col =
5
y =
0 0 0 0 0
y =
2 0 0 0 0
i =
2
j =
1
y =
2 4 0 0 0
i =
3
j =
1
y =
2 4 0 0 0
i =
3
j =
1
y =
2 4 3 0 0
i =
4
j =
1
y =
2 4 3 0 1
i =
6
|
962 Solvers
Project Euler: Problem 8, Find largest product in a large string of numbers
315 Solvers
246 Solvers
277 Solvers
Find the Oldest Person in a Room
5131 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!