Longest Substring Without Repeating Characters
package cn.edu.xidian.sselab.hashtable; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * * @author zhiyong wang * title: Longest Substring Without Repeating Characters * content: * Given a string, find the length of the longest substring without repeating characters. * For example, the longest substring without repeating letters for "abcabcbb" is "abc", * which the length is 3. * For "bbbbb" the longest substring is "b", with the length of 1 * */ public class LongestSubString { //这种方法,时间超时,如果字符串非常长,时间复杂度为O(n^2),肯定会超时,因为这是一个最优化问题,可以用动态规划来解