We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09c8095 commit 721b1d2Copy full SHA for 721b1d2
longest-increasing-subsequence/minji-go.java
@@ -7,22 +7,22 @@
7
*/
8
class Solution {
9
public int lengthOfLIS(int[] nums) {
10
- List<Integer> dp = new ArrayList<>();
+ List<Integer> lisTails = new ArrayList<>();
11
12
for(int num : nums){
13
- int idx = Collections.binarySearch(dp, num);
+ int idx = Collections.binarySearch(lisTails, num);
14
15
if(idx < 0) {
16
idx = -idx -1;
17
}
18
19
- if(idx == dp.size()) {
20
- dp.add(num);
+ if(idx == lisTails.size()) {
+ lisTails.add(num);
21
} else {
22
- dp.set(idx, num);
+ lisTails.set(idx, num);
23
24
25
26
- return dp.size();
+ return lisTails.size();
27
28
0 commit comments