Longest Rising Subsequence
Return the length of the longest strictly increasing subsequence of nums (elements keep their order but need not be adjacent).
Requirements
- An DP is accepted; try for with patience sorting.
Examples
EXAMPLE WALKTHROUGHclassic
A guided view of the published example, not a trace of your code.
INPUT
[[10,9,2,5,3,7,101,18]]TASKlongest_rising_subsequence()
EXPECTED OUTPUT
4Start with the input values shown in this example.
Example 1 of 3
Input: nums = [10,9,2,5,3,7,101,18]
Output: 4
Explanation: classic
Input: nums = [0,1,0,3,2,3]
Output: 4
Explanation: length four
Input: nums = [7,7,7]
Output: 1
Explanation: strictly increasing
Hint 1
Keep tails[i] = the smallest possible tail of an increasing subsequence of length i + 1.
Hint 2
Binary search where each number fits in tails.