题目:
字符串之找到字符串的最大无重复字符子串
举例:
str = "adcd" return 4
str = "aabcd" I know this str is 'adc' so return 3
要求:
时间复杂度为O(N)
代码实现:
package com.chenyu.string.cn;public class MaxUnique {public static void main(String[] args) {String ss[] = {"abcdabcd", "abcffecd", "ababtycd", "abddebcd", "abcfabcd", "abcdadfiopzm"};for (String s: ss) {int result = MaxUnique(s);System.out.println("Max unique string is\t" + result);}}public static int MaxUnique(String target) {if ("".equals(target) || target == null) {return 0;}