time nlgn, convert lcs to lis