Leetcode 334. Increasing Triplet Subsequence-Algorithm

时间:2024-04-29 07:29:52

Dynamic Programming (DP). Following the increasing length of tuples, scan the array from front to back each time, saving the position of the smallest prefix of length L-1: if the data is larger than the smallest prefix, a new sequence of length L is found, otherwise update the prefix.