蚁族的乐土

关注

leetcode485

蚁族的乐土

关注

阅读 68

2022-08-05


#include<cmath>
class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
vector<int>::iterator it;
int ans=0,tmp=0;
for(it=nums.begin();it!=nums.end();it++)
{
if( (*it)==1){
tmp++;
}
if((*it)==0)
{

tmp=0;

}
ans=max(tmp,ans);
}
return ans;
}
};


相关推荐

爱做梦的老巫婆

Leetcode485、283、27(数组篇)

爱做梦的老巫婆 71 0 0

舍予兄

数组-leetcode-485

舍予兄 38 0 0

单调先生

【leetcode】485. Max Consecutive Ones

单调先生 35 0 0

color_小浣熊

【LeetCode】485. 最大连续1的个数

color_小浣熊 31 0 0

捌柒陆壹

leetcode-485-最大连续1的个数 题解

捌柒陆壹 62 0 0

瑾谋

Android 485

瑾谋 24 0 0

书坊尚

LeetCode 训练场:485. 最大连续1的个数

书坊尚 48 0 0

天行五煞

C++描述 LeetCode 485. 最大连续1的个数

天行五煞 45 0 0

mjjackey

android 485触发

mjjackey 60 0 0

书写经典

LeetCode 485. 最大连续 1 的个数(简单、数组)day18

书写经典 33 0 0

精彩评论(0)

0 0 举报