Suppose I have a vector of 0's and 1's. How can I find, without for-loop(s), the longest streak of 1's in that vector?
eg. For the vector v=[0,1,0,0,1,1,0,0, 1,1,1,1,1 ,0,1,0,1], I want codes that return: longest streak=5, location=9 .
Any suggestion? Thanks in advance.
Best Answer