485_Max_Consecutive_Ones_Easy.c
来源:互联网 发布:织梦cms本地安装教程 编辑:程序博客网 时间:2024/06/08 17:06
/*Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3.*/int findMaxConsecutiveOnes(int* nums, int numsSize) { int i,count=0,max=0; for(i=0;i<numsSize;i++) { if(nums[i]==1) count++; if(max <= count) max = count; if(nums[i]==0) count=0; } return max;}
阅读全文
0 0
- 485_Max_Consecutive_Ones_Easy.c
- Bits - CodeForces 485C
- 485ser.c
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- 476_Number_Complement
- cuda总结
- 1124. Raffle for Weibo Followers (20)
- 195. Tenth Line。
- IntelliJ Idea Pycharm PhpStrom WebStrom Clion 2017 免费激活方法
- 485_Max_Consecutive_Ones_Easy.c
- visual studio 2017使用技巧
- SSM整合
- 2018年搜狗秋招前端笔试题:字符串删除
- CodeForces
- CSS经典布局-圣杯布局和双飞翼布局对比
- epoll模型
- [leetcode]解决Majority Element的一点小心得
- visual studio 2017搭建linux c++开发环境