天天看點

[算法]-Longest Increasing Subsequence

看微軟筆試題遇到的。

longest increasing subsequence(lis) means a sequence containing some elements in another sequence by the same order, and the values of elements keeps increasing.for example, lis of {2,1,4,2,3,7,4,6} is {1,2,3,4,6}, and its lis length is 5.considering an array with n elements , what is the lowest time and space complexity to get the length of lis?

算法一:動态規劃

算法二:

繼續閱讀