File tree 2 files changed +3
-3
lines changed
LongestIncreasingSubsequence
2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public int buildingBridges(int[][] cityPairs) {
29
29
* * SC: O(n)
30
30
*/
31
31
private int longestIncreasingSubsequenceDP (int [][] cityPairs ) {
32
- int len = cityPairs .length , maxLen = Integer . MIN_VALUE ;
32
+ int len = cityPairs .length , maxLen = 1 ;
33
33
int [] dp = new int [len ];
34
34
Arrays .fill (dp , 1 );
35
35
@@ -44,7 +44,7 @@ private int longestIncreasingSubsequenceDP(int[][] cityPairs) {
44
44
}
45
45
}
46
46
47
- return dp [ len - 1 ] ;
47
+ return maxLen ;
48
48
}
49
49
50
50
/**
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public int longestIncreasingSubsequence(int[] items) {
26
26
* * SC: O(n)
27
27
*/
28
28
private int longestIncreasingSubsequenceDP (int [] items ) {
29
- int len = items .length , maxLen = Integer . MIN_VALUE , end = 0 ;
29
+ int len = items .length , maxLen = 1 , end = 0 ;
30
30
int [] dp = new int [len ];
31
31
Arrays .fill (dp , 1 );
32
32
You can’t perform that action at this time.
0 commit comments