给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度

This commit is contained in:
LingZhaoHui 2021-01-24 09:10:15 +08:00
parent 59470ea95a
commit 308c9ec6cc

View File

@ -9,6 +9,8 @@ import java.util.Set;
* 输入: "abcabcbb"
* 输出: 3
* 解释: 因为无重复字符的最长子串是 "abc"所以其长度为 3
*
* https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
*
* @author zeekling
* @version 1.0
@ -32,4 +34,9 @@ public class LengthOfLongestSubString{
}
return ans;
}
public static void main(String[] args) {
LengthOfLongestSubString lString = new LengthOfLongestSubString();
String s = "abcabcbb";
System.out.println(lString.lengthOfLongestSubstring(s));
}
}