package com.leecode.week02; import com.sun.org.apache.xpath.internal.operations.Bool; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ * 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 */ public class LeetCode_03_35 { public void printAllSubstring(String s){ char[] chs=s.toCharArray(); for(int i=0;i set=new HashSet<>(); for(int i=0;i set=new HashSet<>(); for(int i=0;i cache=new HashMap<>(); public boolean hasRepeatingChar(String s){ if(cache.containsKey(s)){ return cache.get(s); } char[] chs=s.toCharArray(); Set characters=new HashSet<>(); for (char ch:chs) { if(characters.contains(ch)){ cache.put(s,true); return true; }else { characters.add(ch); } } cache.put(s,false); return false; }*/ }