Loading problem…
Given an integer array nums, return the length of the longest strictly increasing subsequence.
A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.
This is a classic DP problem with two approaches:
lengthOfLIS([10, 9, 2, 5, 3, 7, 101, 18]); // 4
// LIS is [2, 3, 7, 101] or [2, 5, 7, 101]