https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
/*** 法一: 滑动窗口*/public int lengthOfLongestSubstring(String s) {if (s == null || s.length() == 0) {return 0;}char[] str = s.toCharArray();//记录遍历过的字符Set<Character> set = new HashSet<>();int len = Integer.MIN_VALUE;//滑动窗口int R = -1;for (int L = 0; L < s.length(); L++) {if (L != 0) {set.remove(str[L - 1]);}// R往右扩到不能再扩while (R + 1 < s.length() && !set.contains(str[R + 1])) {、、 set.add(str[++R]);}len = Math.max(len, R - L + 1);;}return len;}
