Given a non-empty array of integers, write a function that returns the longest strictly-increasing subsequence of the array. A subsequence is dened as a set of numbers that are not necessarily adjacent but that are in the same order as they appear in the array. Assume that there will only be one longest increasing subsequence.
Sample input: [5, 7, -24, 12, 10, 2, 3, 12, 5, 6, 35] Sample output: [-24, 2, 3, 5, 6, 35]
We can use a Stack here
Check this Python code.