Skip to content

Commit 4dd4885

Browse files
fixed checkstyle violation in NearestElementTest.java
1 parent c715675 commit 4dd4885

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/main/java/com/thealgorithms/datastructures/stacks/NearestElement.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
import java.util.Stack;
44

55
/**
6-
* The {@code NearestElement} class provides static utility methods to find the nearest greater or smaller elements
7-
* to the left or right of each element in an integer array using stack-based algorithms.
6+
* The {@code NearestElement} class provides static utility methods to find the
7+
* nearest greater or smaller elements to the left or right of each element in
8+
* an integer array using stack-based algorithms.
89
*
9-
* <p>Each method runs in O(n) time complexity by maintaining a monotonic stack:
10+
* <p>
11+
* Each method runs in O(n) time complexity by maintaining a monotonic stack:
1012
* <ul>
11-
* <li>{@code nearestGreaterToRight}: Finds the nearest greater element to the right of each element.</li>
12-
* <li>{@code nearestGreaterToLeft}: Finds the nearest greater element to the left of each element.</li>
13-
* <li>{@code nearestSmallerToRight}: Finds the nearest smaller element to the right of each element.</li>
14-
* <li>{@code nearestSmallerToLeft}: Finds the nearest smaller element to the left of each element.</li>
13+
* <li>{@code nearestGreaterToRight}: Finds the nearest greater element to the
14+
* right of each element.</li>
15+
* <li>{@code nearestGreaterToLeft}: Finds the nearest greater element to the
16+
* left of each element.</li>
17+
* <li>{@code nearestSmallerToRight}: Finds the nearest smaller element to the
18+
* right of each element.</li>
19+
* <li>{@code nearestSmallerToLeft}: Finds the nearest smaller element to the
20+
* left of each element.</li>
1521
* </ul>
1622
*/
1723
public final class NearestElement {

src/test/java/com/thealgorithms/stacks/NearestElementTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ void testNearestSmallerToLeft() {
4848

4949
@Test
5050
void testPrivateConstructor() throws Exception {
51-
Constructor<NearestElement> constructor =
52-
NearestElement.class.getDeclaredConstructor();
51+
Constructor<NearestElement> constructor
52+
= NearestElement.class.getDeclaredConstructor();
5353
constructor.setAccessible(true);
5454
try {
5555
constructor.newInstance();

0 commit comments

Comments
 (0)