Last week in an interview I was asked the above question and as expected I wasn't able to answer it correctly, later on when I checked I saw that its a dynamic programming based algorithm. I am not proficient in dynamic programming but suppose I was to design this algorithm then how should I approach it?
Suppose, I take idea from other divide and conquer algorithms like MergeSort and design the solution something like:
- Divide the sequence in two equal halves.
- Find the longest increasing sub-sequence in two halves
- Join the two halves.
Obviously there are missing pieces, but how get forward from here?