Skip to content

Commit 721b1d2

Browse files
committed
refactor: longest-increasing-subsequence naming
1 parent 09c8095 commit 721b1d2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

longest-increasing-subsequence/minji-go.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
*/
88
class Solution {
99
public int lengthOfLIS(int[] nums) {
10-
List<Integer> dp = new ArrayList<>();
10+
List<Integer> lisTails = new ArrayList<>();
1111

1212
for(int num : nums){
13-
int idx = Collections.binarySearch(dp, num);
13+
int idx = Collections.binarySearch(lisTails, num);
1414

1515
if(idx < 0) {
1616
idx = -idx -1;
1717
}
1818

19-
if(idx == dp.size()) {
20-
dp.add(num);
19+
if(idx == lisTails.size()) {
20+
lisTails.add(num);
2121
} else {
22-
dp.set(idx, num);
22+
lisTails.set(idx, num);
2323
}
2424
}
2525

26-
return dp.size();
26+
return lisTails.size();
2727
}
2828
}

0 commit comments

Comments
 (0)