Skip to content

Commit fed1525

Browse files
author
Alex Klymenko
committed
refactor: LongestNonRepetitiveSubstring
1 parent 5149051 commit fed1525

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/main/java/com/thealgorithms/strings/LongestNonRepeativeSubstring.java renamed to src/main/java/com/thealgorithms/strings/LongestNonRepetitiveSubstring.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
package com.thealgorithms.strings;
22

33
import java.util.HashMap;
4+
import java.util.Map;
45

5-
final class LongestNonRepeativeSubstring {
6-
private LongestNonRepeativeSubstring() {
6+
final class LongestNonRepetitiveSubstring {
7+
private LongestNonRepetitiveSubstring() {
78
}
89

910
public static int lengthOfLongestSubstring(String s) {
1011
int max = 0;
1112
int start = 0;
1213
int i = 0;
13-
HashMap<Character, Integer> map = new HashMap<>();
14+
Map<Character, Integer> map = new HashMap<>();
1415

1516
while (i < s.length()) {
1617
char temp = s.charAt(i);

src/test/java/com/thealgorithms/strings/LongestNonRepeativeSubstringTest.java renamed to src/test/java/com/thealgorithms/strings/LongestNonRepetitiveSubstringTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import org.junit.jupiter.api.Assertions;
44
import org.junit.jupiter.api.Test;
55

6-
public class LongestNonRepeativeSubstringTest {
6+
public class LongestNonRepetitiveSubstringTest {
77

88
@Test
99
public void palindrome() {
1010
String input1 = "HelloWorld";
1111
String input2 = "javaIsAProgrammingLanguage";
12-
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input1), 5);
13-
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input2), 9);
12+
Assertions.assertEquals(LongestNonRepetitiveSubstring.lengthOfLongestSubstring(input1), 5);
13+
Assertions.assertEquals(LongestNonRepetitiveSubstring.lengthOfLongestSubstring(input2), 9);
1414
}
1515
}

0 commit comments

Comments
 (0)