I have a list of 1s and 0s. Say: 1,1,1,0,0,1,1,1,1,1,0,1,1,1,0,0,0,1
I want to get the max length of sequences of 1s.
In this case, the sequences are 3,5,3,1 and the max is 5.
I have this code (using answer from an S.O. question: Getting pair set using linq)
var list = new[]{1,1,1,0,0,1,1,1,1,1,0,1,1,1,0,0,0,1}.ToList();
var pairs = list.Where( (e,i) => i < list.Count - 1 )
.Select( (e,i) => new { A = e, B = list[i+1] } ).ToList();
var analyzed = pairs.ConvertAll( p=> new ... not sure how to continue