Skip to content

Commit 630419d

Browse files
committed
checkstyle: fix clang formatting
1 parent e39459c commit 630419d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/thealgorithms/strings/LongestCommonPrefix.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public static String longestCommonPrefix(String[] strs) {
3333
String last = strs[strs.length - 1];
3434

3535
int index = 0;
36-
while (index < first.length() && index < last.length() &&
37-
first.charAt(index) == last.charAt(index)) {
36+
while (index < first.length() && index < last.length() && first.charAt(index) == last.charAt(index)) {
3837
index++;
3938
}
4039

src/test/java/com/thealgorithms/strings/LongestCommonPrefixTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import static org.junit.jupiter.api.Assertions.assertEquals;
44

55
import java.util.stream.Stream;
6+
import org.junit.jupiter.api.DisplayName;
67
import org.junit.jupiter.params.ParameterizedTest;
78
import org.junit.jupiter.params.provider.Arguments;
89
import org.junit.jupiter.params.provider.MethodSource;
9-
import org.junit.jupiter.api.DisplayName;
1010

1111
public class LongestCommonPrefixTest {
1212

@@ -18,6 +18,7 @@ void testLongestCommonPrefix(String[] input, String expected) {
1818
}
1919

2020
private static Stream<Arguments> provideTestCases() {
21-
return Stream.of(Arguments.of(new String[]{"flower", "flow", "flight"}, "fl"), Arguments.of(new String[]{"dog", "racecar", "car"}, ""), Arguments.of(new String[]{}, ""), Arguments.of(null, ""), Arguments.of(new String[]{"single"}, "single"), Arguments.of(new String[]{"ab", "a"}, "a"), Arguments.of(new String[]{"test", "test", "test"}, "test"), Arguments.of(new String[]{"abcde", "abcfgh", "abcmnop"}, "abc"), Arguments.of(new String[]{"Flower", "flow", "flight"}, ""));
21+
return Stream.of(Arguments.of(new String[] {"flower", "flow", "flight"}, "fl"), Arguments.of(new String[] {"dog", "racecar", "car"}, ""), Arguments.of(new String[] {}, ""), Arguments.of(null, ""), Arguments.of(new String[] {"single"}, "single"), Arguments.of(new String[] {"ab", "a"}, "a"),
22+
Arguments.of(new String[] {"test", "test", "test"}, "test"), Arguments.of(new String[] {"abcde", "abcfgh", "abcmnop"}, "abc"), Arguments.of(new String[] {"Flower", "flow", "flight"}, ""));
2223
}
2324
}

0 commit comments

Comments
 (0)