1 Make a sorted copy of the sequence A, denoted as B. O(nlog(n)) time.
2 Use Longest Common Subsequence on with A and B. DP(O(n^2)时间)
是O(n^2)时间了 比最优的要差一些了
刚才搞错了
f*********i 发帖数: 197
2
2 Use Longest Common Subsequence on with A and B. DP(O(n)时间)
how to do that in O(n)?