标签:rem return 字符 res end mat static stat amp
public static int lengthOfLongestSubstring(String s) { int len = s.length(); int res = 0; int start = 0; int end = 0; HashSet set = new HashSet(); while (start < s.length() && end < s.length()) { if (set.contains(s.charAt(end))) { set.remove(s.charAt(start)); start++; } else { set.add(s.charAt(end)); end++; res = Math.max(res, end - start); } } return res; }
标签:rem return 字符 res end mat static stat amp
原文地址:https://www.cnblogs.com/pusan/p/12219841.html