Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit699e86c

Browse files
refactor 300
1 parent14108df commit699e86c

File tree

1 file changed

+5
-1
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+5
-1
lines changed

‎src/main/java/com/fishercoder/solutions/_300.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ public static class Solution4 {
102102
* Time: O(nlogn)
103103
* Space: O(n)
104104
* <p>
105-
* The reason we can use binary search here is because all numbers we put into dp array are sorted
105+
* The reason we can use binary search here is because all numbers we put into dp array are sorted.
106+
* Arrays.binarySearch() method returns index of the search key,
107+
* if it is contained in the array, else it returns (-(insertion point) - 1).
108+
* The insertion point is the point at which the key would be inserted into the array:
109+
* the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key.
106110
*/
107111
publicintlengthOfLIS(int[]nums) {
108112
int[]dp =newint[nums.length];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp