public class Solution {
/**
* @param nums: The integer array
* @return: The length of LIS (longest increasing subsequence)
*/
public int longestIncreasingSubsequence(int[] nums) {
// write your code here
if(nums.length==0){
return 0;
}
int dp[]=new int[nums.length];
for(int i=0;i<nums.length;i++){
dp[i]=1;
for(int j=0;j<i;j++){
if(nums[i]>nums[j]&&dp[j]+1>dp[i])
dp[i]=dp[j]+1;
}
}
int max=Integer.MIN_VALUE;
for(int i=0;i<nums.length;i++){
max=Math.max(max, dp[i]);
}
return max;
}
}