refactor: fix typo in class name LongestNonRepetitiveSubstring (#5359)

This commit is contained in:
Alex Klymenko 2024-08-22 11:37:52 +02:00 committed by GitHub
parent 622a3bf795
commit 74b05ef7c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -1,16 +1,17 @@
package com.thealgorithms.strings;
import java.util.HashMap;
import java.util.Map;
final class LongestNonRepeativeSubstring {
private LongestNonRepeativeSubstring() {
final class LongestNonRepetitiveSubstring {
private LongestNonRepetitiveSubstring() {
}
public static int lengthOfLongestSubstring(String s) {
int max = 0;
int start = 0;
int i = 0;
HashMap<Character, Integer> map = new HashMap<>();
Map<Character, Integer> map = new HashMap<>();
while (i < s.length()) {
char temp = s.charAt(i);

View File

@ -3,13 +3,13 @@ package com.thealgorithms.strings;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class LongestNonRepeativeSubstringTest {
public class LongestNonRepetitiveSubstringTest {
@Test
public void palindrome() {
String input1 = "HelloWorld";
String input2 = "javaIsAProgrammingLanguage";
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input1), 5);
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input2), 9);
Assertions.assertEquals(LongestNonRepetitiveSubstring.lengthOfLongestSubstring(input1), 5);
Assertions.assertEquals(LongestNonRepetitiveSubstring.lengthOfLongestSubstring(input2), 9);
}
}