300. Longest Increasing Subsequence
Here we solve 300. Longest Increasing Subsequence. It asks us for the length of the longest strictly increasing subsequence in an array. So, for the array [3, 2, 6, 2, 9, 2, 7, 1, 4, 2, 15, 16, 14, 18, 1], the answer would be 6, one of such arrays being [2, 6, 7, 15, 16, 18].
Solution We solve this problem by iteratively building a subsequence from left to right, obeying the following rules: