问题:
思路:
import numpy as np
class Solution(object):
def increasingTriplet(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if len(nums) < 3:
return False
record = np.zeros((len(nums)))
record[0] = 1
for i in range(1, len(nums)):
n_max = 1
for j in range(i):
if nums[j]<nums[i]:
n = record[j]+1
if n>n_max:
n_max = n
record[i] = n_max
return int(max(record))
网友评论