For each position i, compute the longest increasing subsequence ending at i. dp[i] = length of LIS ending at index i. For each j < i, if nums[j] < nums[i], then you can extend the subsequence ending at j. dp[i] = max(dp[i], dp[j] + ). Base case: every element is a subsequence of length .
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/maang-interview-prep/dynamic-programming/lis-hint
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████████