package code; /* * 3. Longest Substring Without Repeating Characters * 题意:找出字符串中没有重复字母的最大长度 * 难度:Medium * 分类:Hash Table, Two Pointers, String * 算法:两个指针,记录没有重复字母的子串的首和尾 * lc76 */ import java.util.HashMap; public class lc3 { public static void main(String[] args) { String s = "abba"; System.out.println(lengthOfLongestSubstring(s)); } public static int lengthOfLongestSubstring(String s) { HashMap hm = new HashMap<>(); int max = 0; int j = 0; for (int i = 0; i