Skip to content

Latest commit

 

History

History
executable file
·
23 lines (11 loc) · 615 Bytes

Longest_Increasing_Subsequence.md

File metadata and controls

executable file
·
23 lines (11 loc) · 615 Bytes

Longest Increasing Subsequence

Problem Statement

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]

Explanation

We can use a Stack here

Solution

Check this Python code.