mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 03:11:42 +08:00
add leetcode problem-cn part5
This commit is contained in:
26
算法题(国内版)/problem (Chinese)/连续数组 [contiguous-array].html
Normal file
26
算法题(国内版)/problem (Chinese)/连续数组 [contiguous-array].html
Normal file
@@ -0,0 +1,26 @@
|
||||
<p>给定一个二进制数组 <code>nums</code> , 找到含有相同数量的 <code>0</code> 和 <code>1</code> 的最长连续子数组,并返回该子数组的长度。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> nums = [0,1]
|
||||
<strong>输出:</strong> 2
|
||||
<strong>说明:</strong> [0, 1] 是具有相同数量 0 和 1 的最长连续子数组。</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> nums = [0,1,0]
|
||||
<strong>输出:</strong> 2
|
||||
<strong>说明:</strong> [0, 1] (或 [1, 0]) 是具有相同数量0和1的最长连续子数组。</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>nums[i]</code> 不是 <code>0</code> 就是 <code>1</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user