11 - Longest Increasing Subsequence - Final DP solution in Java

@Rishi Srivastava Pseudo code: int[] dp = new int[]; (dp, 1); for (int i = - 1; i is greater than or equal to 0; i--) { for (int j = i 1; j is less than ; j ) { if (nums[i] is less than nums[j]) { dp[i] = MAX(dp[i], 1 dp[j]); } } } return MAX(dp[]); Time complexity: O(n^2) Space complexity: O(n) Github: Leetcode:
Back to Top