File tree 1 file changed +5
-1
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,11 @@ public static class Solution4 {
102
102
* Time: O(nlogn)
103
103
* Space: O(n)
104
104
* <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.
106
110
*/
107
111
public int lengthOfLIS (int [] nums ) {
108
112
int [] dp = new int [nums .length ];
You can’t perform that action at this time.
0 commit comments