We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent14108df commit699e86cCopy full SHA for 699e86c
src/main/java/com/fishercoder/solutions/_300.java
@@ -102,7 +102,11 @@ public static class Solution4 {
102
* Time: O(nlogn)
103
* Space: O(n)
104
* <p>
105
- * The reason we can use binary search here is because all numbers we put into dp array are sorted
+ * 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.
110
*/
111
publicintlengthOfLIS(int[]nums) {
112
int[]dp =newint[nums.length];