Max Consecutive Ones
Given a binary array, find the maximum number of consecutive 1s in this array.
Example 1:
题目大意:
给定一个二进制数组,计算数组中出现的最大连续1的个数。
注意:
输入数组只包含0和1
数组长度是正整数并且不会超过10000
解题思路:
一趟遍历+计数器
Last updated
Was this helpful?
Given a binary array, find the maximum number of consecutive 1s in this array.
Example 1:
给定一个二进制数组,计算数组中出现的最大连续1的个数。
注意:
输入数组只包含0和1
数组长度是正整数并且不会超过10000
一趟遍历+计数器
Last updated
Was this helpful?