最大连续1的个数
2025-4-20
| 2025-4-20
Words 206Read Time 1 min
type
status
date
slug
summary
tags
category
icon
password

题目:

给定一个二进制数组 nums , 计算其中最大连续 1 的个数。
来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/SNJvJP 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
示例 1:
示例 2:
提示:
  • 1 <= nums.length <= 105
  • nums[i] 不是 0 就是 1.

思路:

  • 两个指针来计数

代码:

结果:

notion image
image-20220329202027222
最富有客户的资产总量最大子数组和
Loading...