func findMaxConsecutiveOnes(nums []int) (max int) { cnt := 0 for _, i := range nums { if i == 1 { cnt++ } else { if max < cnt { max = cnt } cnt = 0 } } if max < cnt { max = cnt } return }