题目:
题解:
func lengthOfLIS(nums []int) int {
if len(nums)<=1{
return len(nums)
}
dp := make([]int,len(nums))
for i:=0;i<len(nums);i++{dp[i]=1}
res := 1
for i:=1;i<len(nums);i++{
for j:=0;j<i;j++{
if nums[i] > nums[j]{
dp[i] = max(dp[i],dp[j]+1)
res = max(res,dp[i])
}
}
}
return res
}
func max(i,j int)int{
if i>j{
return i
}else{
return j
}
}