Skip to content

Commit a974cb5

Browse files
committed
Refactor comments and import statements for consistency and clarity in LongestIncreasingSubsequenceNLogN and its test class
1 parent c2ba818 commit a974cb5

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/main/java/com/thealgorithms/dynamicprogramming/LongestIncreasingSubsequenceNLogN.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
*/
99
public class LongestIncreasingSubsequenceNLogN {
1010

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+
*/
2121
private static int lowerBound(int[] arr, int target, int size) {
2222
int l = 0, r = size;
2323

@@ -29,12 +29,12 @@ private static int lowerBound(int[] arr, int target, int size) {
2929
l = mid + 1;
3030
} else {
3131
// Move left if target is less than or equal to mid element
32-
r = mid;
32+
r = mid;
3333
}
3434
}
3535

3636
// Return the index where the target can be inserted
37-
return l;
37+
return l;
3838
}
3939

4040
/**
@@ -66,7 +66,7 @@ public static int lengthOfLIS(int[] arr) {
6666
}
6767
}
6868

69-
// Return the length of the LIS
69+
// Return the length of the LIS
7070
return size;
7171
}
7272
}

src/test/java/com/thealgorithms/dynamicprogramming/LongestIncreasingSubsequenceNLogNTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.thealgorithms.dynamicprogramming;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
4-
53
import java.util.stream.Stream;
64

5+
import static org.junit.jupiter.api.Assertions.assertEquals;
6+
77
import org.junit.jupiter.params.ParameterizedTest;
88
import org.junit.jupiter.params.provider.Arguments;
99
import org.junit.jupiter.params.provider.MethodSource;

0 commit comments

Comments
 (0)