Myvideo

Guest

Login

11 - Longest Increasing Subsequence - Final DP solution in Java

Uploaded By: Myvideo
1 view
0
0 votes
0

@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:

Share with your friends

Link:

Embed:

Video Size:

Custom size:

x

Add to Playlist:

Favorites
My Playlist
Watch Later