-
2 Comments
Haoyu Dai
on 30 Apr 2020
function y = lengthOnes(x)
cnt=0;
a=[];
L=strlength(x);
for i=1:L
if x(i)=='1'
cnt=cnt+1;
else
cnt=0;
end
a(i)=cnt;
end
[y,index]=max(a);
end
Syed Shahed
on 3 May 2020
Excellent work man :)
Suggested Problems
-
4356 Solvers
-
2763 Solvers
-
2966 Solvers
-
599 Solvers
-
Is this is a Tic Tac Toe X Win?
513 Solvers
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!