8
8
*/
9
9
public class LongestIncreasingSubsequenceNLogN {
10
10
11
- /**
12
- * Finds the index of the smallest element in the array that is greater than
13
- * or equal to the target using binary search. The search is restricted to
14
- * the first `size` elements of the array.
15
- *
16
- * @param arr The array to search in (assumed to be sorted up to `size`).
17
- * @param size The number of valid elements in the array.
18
- * @param target The target value to find the lower bound for.
19
- * @return The index of the lower bound.
20
- */
11
+ /**
12
+ * Finds the index of the smallest element in the array that is greater than
13
+ * or equal to the target using binary search. The search is restricted to
14
+ * the first `size` elements of the array.
15
+ *
16
+ * @param arr The array to search in (assumed to be sorted up to `size`).
17
+ * @param size The number of valid elements in the array.
18
+ * @param target The target value to find the lower bound for.
19
+ * @return The index of the lower bound.
20
+ */
21
21
private static int lowerBound (int [] arr , int target , int size ) {
22
22
int l = 0 , r = size ;
23
23
@@ -29,12 +29,12 @@ private static int lowerBound(int[] arr, int target, int size) {
29
29
l = mid + 1 ;
30
30
} else {
31
31
// Move left if target is less than or equal to mid element
32
- r = mid ;
32
+ r = mid ;
33
33
}
34
34
}
35
35
36
36
// Return the index where the target can be inserted
37
- return l ;
37
+ return l ;
38
38
}
39
39
40
40
/**
@@ -66,7 +66,7 @@ public static int lengthOfLIS(int[] arr) {
66
66
}
67
67
}
68
68
69
- // Return the length of the LIS
69
+ // Return the length of the LIS
70
70
return size ;
71
71
}
72
72
}
0 commit comments