485. 最大连续 1 的个数c
int findMaxConsecutiveOnes(int* nums, int numsSize) {
int max=0,index=0,count=0;
while(index<numsSize){
if(nums[index]==1){
count++;
if(count>max) max=count;
}else{
count=0;
}
index++;
}
return max;
}
浙公网安备 33010602011771号