class Solution {
public int findMaxConsecutiveOnes(int[] nums) {
int max=0;
int count=0;
for (int i : nums) {
if(i==0)
count=0;
else
count++;
max=max>count?max:count;
}
return max;
}
}
leetcode:485. 最大连续1的个数
猜你喜欢
转载自blog.csdn.net/qq_42405666/article/details/89577559
今日推荐
周排行