Subsequence Problem

Revision en1, by harrypotter0, 2017-09-19 16:52:12

Given an int array which might contain duplicates, find the largest subset of it which form a sequence. Ex: {1,6,10,4,7,9,5} then ans is 4,5,6,7

Sorting is an obvious solution. Can this be done in O(n) time ??

Thanks in advance :)

Tags sorting, increasing subsequence

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English harrypotter0 2017-09-19 16:52:12 262 Initial revision (published)