mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
44 lines
1.1 KiB
HTML
44 lines
1.1 KiB
HTML
|
<p>给你一个整数数组 <code>nums</code> ,找到其中最长严格递增子序列的长度。</p>
|
|||
|
|
|||
|
<p><strong>子序列 </strong>是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。例如,<code>[3,6,2,7]</code> 是数组 <code>[0,3,1,6,2,2,7]</code> 的子序列。</p>
|
|||
|
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>nums = [10,9,2,5,3,7,101,18]
|
|||
|
<strong>输出:</strong>4
|
|||
|
<strong>解释:</strong>最长递增子序列是 [2,3,7,101],因此长度为 4 。
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 2:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>nums = [0,1,0,3,2,3]
|
|||
|
<strong>输出:</strong>4
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 3:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>nums = [7,7,7,7,7,7,7]
|
|||
|
<strong>输出:</strong>1
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>提示:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li><code>1 <= nums.length <= 2500</code></li>
|
|||
|
<li><code>-10<sup>4</sup> <= nums[i] <= 10<sup>4</sup></code></li>
|
|||
|
</ul>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><b>进阶:</b></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li>你能将算法的时间复杂度降低到 <code>O(n log(n))</code> 吗?</li>
|
|||
|
</ul>
|