###### Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.

For example,
Given [10, 9, 2, 5, 3, 7, 101, 18],
The longest increasing subsequence is [2, 3, 7, 101], therefore the length is 4. Note that there may be more than one LIS combination, it is only necessary for you to return the length.

O(n2)

class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
int n=nums.size();
if(n==0) return 0;
if(n==1) return 1;
vector<int>dp(n,1);
for(int i=1;i<n;i++){
for(int j=i-1;j>=0;j--){
if(nums[i]>nums[j]){
dp[i]=max(dp[i],dp[j]+1);
}
}
}
return *max_element(dp.begin(),dp.end());
}
};

#### LWC 49：674. Longest Continuous Increasing Subsequence

2017-09-10 14:03:50

#### 【LEETCODE】300-Longest Increasing Subsequence [Python]

2016-01-07 20:36:24

#### Geeksforgeeks面试题 - Longest Increasing Subsequence

2013-12-31 08:07:16

#### LeetCode 300. Longest Increasing Subsequence 解题报告

2016-02-16 19:35:07

#### LWC 49：673. Number of Longest Increasing Subsequence

2017-09-10 17:56:46

#### 673. Number of Longest Increasing Subsequence

2017-09-10 11:03:51

#### leetcode 300. Longest Increasing Subsequence-最长子序列|动态规划

2016-06-02 20:17:05

#### leetcode（300）—— Longest Increasing Subsequence（最长递增子序列）

2016-06-08 11:33:06

#### 300. Longest Increasing Subsequence（C++实现）

2016-06-30 09:52:04

#### Longest Increasing Subsequence (LIS) 的java实现

2011-02-17 04:33:00

## 不良信息举报

Longest Increasing Subsequence