Skip to content

Commit 0846b23

Browse files
Sync LeetCode submission Runtime - 67 ms (58.49%), Memory - 14.3 MB (62.62%)
1 parent a1d3880 commit 0846b23

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

LeetCode/0300-longest-increasing-subsequence/solution.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ class Solution {
66
int ans = 1;
77
for (int i=1; i<n; i++) {
88
for (int j=0; j<i; j++) {
9-
if (nums[i] > nums[j]) dp[i] = max(dp[i], dp[j]+1);
9+
if (nums[i] > nums[j]) dp[i] = max(dp[i], dp[j] + 1);
10+
ans = max(ans, dp[i]);
1011
}
11-
ans = max(ans, dp[i]);
1212
}
13-
1413
return ans;
1514
}
1615
};

0 commit comments

Comments
 (0)