. 1 "" " 2 the Given the unsorted AN Array of integers, Find The longest length of Increasing subsequence. . 3 Example . 4 the Input: [10,9,2,5,3,7,101,18] . 5 the Output:. 4 . 6 Explanation: Increasing of The longest IS subsequence [2,3,7,101], THEREFORE 4. the length IS . 7 "" " . 8 " "" . 9 is similar to 139,322 10 have found the dynamic programming equation . 11 F (I) =. 1 + max (F (J ) IF the nums [I]> the nums [J]) (J <I) 12 is particularly noted that the array is initialized. 1 13 is "" " 14 class Solution: 15 DEF lengthOfLIS (Self, the nums): 16 if not nums: #bug nums == None 无法通过 nums = []的情况 17 return 0 18 dp = [1] * (len(nums)+1) 19 for i in range(1, len(nums)): 20 for j in range(i): 21 if nums[j] < nums[i]: 22 dp[i] = max(dp[i], dp[j] + 1) 23 return max(dp) 24 25 # nums1 = None 26 # nums2 = [] 27 # if nums1 == None: 28 # Print ( '. 1') 29 # IF Not nums1: 30 # Print ( '2') 31 is # IF nums2 == None: this situation can not be determined for # = the nums [] 32 # Print ( '. 3') 33 is # IF nums2 Not: 34 is # Print ( '. 4') 35 # #Answer of 124