Skip to content

Commit 699e86c

Browse files
refactor 300
1 parent 14108df commit 699e86c

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
public int lengthOfLIS(int[] nums) {
108112
int[] dp = new int[nums.length];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy