javascript-algorithms
javascript-algorithms copied to clipboard
Return `longestIncreasingSubsequence` from `dpLongestIncreasingSubsequence`
The Longest Increasing Subsequence README.md and dpLongestIncreasingSubsequence.test.js give examples of the longest increasing subsequence that will be generated from various sequences:
In the first 16 terms of the binary Van der Corput sequence
0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15a longest increasing subsequence is
0, 2, 6, 9, 11, 15.
However, the implemented algorithm only returns the length of the longest increasing subsequence, not the subsequence itself. This change will create the longestIncreasingSubsequence from the lengthsArray and return that instead of longestIncreasingLength.
The tests have been updated to expect a subsequence instead of length.