HTMLify

LeetCode - Max Consecutive Ones - Go
Views: 2 | Author: abh
func findMaxConsecutiveOnes(nums []int) int {
    m := 0
    cc := 0
    for _, n := range nums {
        if n != 1 {
            cc = 0
            continue
        }
        cc++
        if cc > m {
            m = cc
        }
    }
    return m
}

Comments