1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/分割数组为连续子序列 [split-array-into-consecutive-subsequences].html
2022-03-29 12:43:11 +08:00

43 lines
990 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个按升序排序的整数数组 <code>num</code>(可能包含重复数字),请你将它们分割成一个或多个长度至少为 3 的子序列,其中每个子序列都由连续整数组成。</p>
<p>如果可以完成上述分割,则返回 <code>true</code> ;否则,返回 <code>false</code></p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong> [1,2,3,3,4,5]
<strong>输出:</strong> True
<strong>解释:</strong>
你可以分割出这样两个连续子序列 :
1, 2, 3
3, 4, 5
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong> [1,2,3,3,4,4,5,5]
<strong>输出:</strong> True
<strong>解释:</strong>
你可以分割出这样两个连续子序列 :
1, 2, 3, 4, 5
3, 4, 5
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong> [1,2,3,4,4,5]
<strong>输出:</strong> False
</pre>
<p> </p>
<p><b>提示:</b></p>
<ul>
<li><code>1 <= nums.length <= 10000</code></li>
</ul>