Skip to content

Commit 74df843

Browse files
checking lint issue
Signed-off-by: JeevaRamanathan <jeevaramanathan.m@infosys.com>
1 parent f153f33 commit 74df843

File tree

2 files changed

+41
-59
lines changed

2 files changed

+41
-59
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ public static boolean isIsogramByLength(String str) {
8080
}
8181
return uniqueChars.size() == str.length();
8282
}
83-
}
83+
}

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

Lines changed: 40 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -14,67 +14,48 @@ record IsogramTestCase(String input, boolean expected) {
1414

1515
private static Stream<IsogramTestCase> isogramArrayTestData() {
1616
return Stream.of(
17-
// Valid isograms (only checks letters)
18-
new IsogramTestCase("uncopyrightable", true), new IsogramTestCase("dermatoglyphics", true),
19-
new IsogramTestCase("background", true), new IsogramTestCase("python", true),
20-
new IsogramTestCase("keyboard", true), new IsogramTestCase("clipboard", true),
21-
new IsogramTestCase("flowchart", true),
22-
new IsogramTestCase("bankruptcy", true), new IsogramTestCase("computer", true),
23-
new IsogramTestCase("algorithms", true),
24-
25-
// Not isograms - letters repeat
26-
new IsogramTestCase("hello", false), new IsogramTestCase("programming", false),
27-
new IsogramTestCase("java", false), new IsogramTestCase("coffee", false),
28-
new IsogramTestCase("book", false), new IsogramTestCase("letter", false),
29-
new IsogramTestCase("mississippi", false),
30-
new IsogramTestCase("google", false),
31-
32-
// Edge cases
33-
new IsogramTestCase("", true), new IsogramTestCase("a", true), new IsogramTestCase("ab", true),
34-
new IsogramTestCase("abc", true), new IsogramTestCase("aa", false),
35-
new IsogramTestCase("abcdefghijklmnopqrstuvwxyz", true), // All 26 letters
36-
37-
// Case insensitive
38-
new IsogramTestCase("Python", true), new IsogramTestCase("BACKGROUND", true),
39-
new IsogramTestCase("Hello", false), new IsogramTestCase("PROGRAMMING", false));
17+
// Valid isograms (only checks letters)
18+
new IsogramTestCase("uncopyrightable", true), new IsogramTestCase("dermatoglyphics", true), new IsogramTestCase("background", true), new IsogramTestCase("python", true), new IsogramTestCase("keyboard", true), new IsogramTestCase("clipboard", true), new IsogramTestCase("flowchart", true),
19+
new IsogramTestCase("bankruptcy", true), new IsogramTestCase("computer", true), new IsogramTestCase("algorithms", true),
20+
21+
// Not isograms - letters repeat
22+
new IsogramTestCase("hello", false), new IsogramTestCase("programming", false), new IsogramTestCase("java", false), new IsogramTestCase("coffee", false), new IsogramTestCase("book", false), new IsogramTestCase("letter", false), new IsogramTestCase("mississippi", false),
23+
new IsogramTestCase("google", false),
24+
25+
// Edge cases
26+
new IsogramTestCase("", true), new IsogramTestCase("a", true), new IsogramTestCase("ab", true), new IsogramTestCase("abc", true), new IsogramTestCase("aa", false), new IsogramTestCase("abcdefghijklmnopqrstuvwxyz", true),
27+
28+
// Case insensitive
29+
new IsogramTestCase("Python", true), new IsogramTestCase("BACKGROUND", true), new IsogramTestCase("Hello", false), new IsogramTestCase("PROGRAMMING", false));
4030
}
4131

4232
private static Stream<IsogramTestCase> isogramLengthTestData() {
4333
return Stream.of(
44-
// Valid isograms (checks all characters)
45-
new IsogramTestCase("uncopyrightable", true), new IsogramTestCase("dermatoglyphics", true),
46-
new IsogramTestCase("background", true), new IsogramTestCase("python", true),
47-
new IsogramTestCase("keyboard", true), new IsogramTestCase("clipboard", true),
48-
new IsogramTestCase("flowchart", true),
49-
new IsogramTestCase("bankruptcy", true), new IsogramTestCase("computer", true),
50-
new IsogramTestCase("algorithms", true),
51-
52-
// Not isograms - characters repeat
53-
new IsogramTestCase("hello", false), new IsogramTestCase("programming", false),
54-
new IsogramTestCase("java", false), new IsogramTestCase("coffee", false),
55-
new IsogramTestCase("book", false), new IsogramTestCase("letter", false),
56-
new IsogramTestCase("mississippi", false),
57-
new IsogramTestCase("google", false),
58-
59-
// Edge cases
60-
new IsogramTestCase("", true), new IsogramTestCase("a", true), new IsogramTestCase("ab", true),
61-
new IsogramTestCase("abc", true), new IsogramTestCase("aa", false),
62-
new IsogramTestCase("abcdefghijklmnopqrstuvwxyz", true), // All 26 letters
63-
64-
// Case insensitive
65-
new IsogramTestCase("Python", true), new IsogramTestCase("BACKGROUND", true),
66-
new IsogramTestCase("Hello", false), new IsogramTestCase("PROGRAMMING", false),
67-
68-
// Strings with symbols and numbers
69-
new IsogramTestCase("abc@def", true), // all characters unique
70-
new IsogramTestCase("test-case", false), // 't', 's', 'e' repeat
71-
new IsogramTestCase("python123", true), // all characters unique
72-
new IsogramTestCase("hello@123", false), // 'l' repeats
73-
new IsogramTestCase("abc123!@#", true), // all characters unique
74-
new IsogramTestCase("test123test", false), // 't', 'e', 's' repeat
75-
new IsogramTestCase("1234567890", true), // all digits unique
76-
new IsogramTestCase("12321", false), // '1' and '2' repeat
77-
new IsogramTestCase("!@#$%^&*()", true) // all special characters unique
34+
// Valid isograms (checks all characters)
35+
new IsogramTestCase("uncopyrightable", true), new IsogramTestCase("dermatoglyphics", true), new IsogramTestCase("background", true), new IsogramTestCase("python", true), new IsogramTestCase("keyboard", true), new IsogramTestCase("clipboard", true), new IsogramTestCase("flowchart", true),
36+
new IsogramTestCase("bankruptcy", true), new IsogramTestCase("computer", true), new IsogramTestCase("algorithms", true),
37+
38+
// Not isograms - characters repeat
39+
new IsogramTestCase("hello", false), new IsogramTestCase("programming", false), new IsogramTestCase("java", false), new IsogramTestCase("coffee", false), new IsogramTestCase("book", false), new IsogramTestCase("letter", false), new IsogramTestCase("mississippi", false),
40+
new IsogramTestCase("google", false),
41+
42+
// Edge cases
43+
new IsogramTestCase("", true), new IsogramTestCase("a", true), new IsogramTestCase("ab", true), new IsogramTestCase("abc", true), new IsogramTestCase("aa", false), new IsogramTestCase("abcdefghijklmnopqrstuvwxyz", true),
44+
45+
// Case insensitive
46+
new IsogramTestCase("Python", true), new IsogramTestCase("BACKGROUND", true), new IsogramTestCase("Hello", false), new IsogramTestCase("PROGRAMMING", false),
47+
48+
49+
// Strings with symbols and numbers
50+
new IsogramTestCase("abc@def", true), // all characters unique
51+
new IsogramTestCase("test-case", false), // 't', 's', 'e' repeat
52+
new IsogramTestCase("python123", true), // all characters unique
53+
new IsogramTestCase("hello@123", false), // 'l' repeats
54+
new IsogramTestCase("abc123!@#", true), // all characters unique
55+
new IsogramTestCase("test123test", false), // 't', 'e', 's' repeat
56+
new IsogramTestCase("1234567890", true), // all digits unique
57+
new IsogramTestCase("12321", false), // '1' and '2' repeat
58+
new IsogramTestCase("!@#$%^&*()", true) // all special characters unique
7859
);
7960
}
8061

@@ -108,4 +89,5 @@ void testEmptyStringByArray() {
10889
@Test
10990
void testEmptyStringByLength() {
11091
assertEquals(true, Isogram.isIsogramByLength(""));
111-
}
92+
}
93+
}

0 commit comments

Comments
 (0)