X Tutup
Skip to content

Commit f7ab48d

Browse files
committed
no message
1 parent 3f7e620 commit f7ab48d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

notes/数据结构与算法.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,41 @@ public class Solution2 {
10211021

10221022

10231023

1024+
### 3. 最长上升子序列
1025+
1026+
给定一个无序的整数数组,找到其中最长上升子序列的长度。
1027+
1028+
**示例:**
1029+
1030+
```
1031+
输入: [10,9,2,5,3,7,101,18]
1032+
输出: 4
1033+
解释: 最长的上升子序列是 [2,3,7,101],它的长度是 4。
1034+
```
1035+
1036+
**说明:**
1037+
1038+
- 可能会有多种最长上升子序列的组合,你只需要输出对应的长度即可。
1039+
- 你算法的时间复杂度应该为 O(*n2*) 。
1040+
1041+
**进阶:** 你能将算法的时间复杂度降低到 O(*n* log *n*) 吗?
1042+
1043+
1044+
1045+
LIS( i ) 表示以第 i 个数字为结尾的最长上升子序列的长度
1046+
1047+
LIS( i ) 表示 [0...i] 的范围内,选择数字nums[i]可以获得的最长上升子序列的长度
1048+
1049+
LIS ( i ) = max<sub>j<i</sub>( 1 + LIS( j ) if nums[i] > nums[j] )
1050+
1051+
1052+
1053+
1054+
1055+
1056+
1057+
1058+
10241059
动态规划解决01背包问题 - Christal_R - 博客园
10251060
https://www.cnblogs.com/Christal-R/p/Dynamic_programming.html
10261061

0 commit comments

Comments
 (0)
X Tutup