Longest Substring Without Repeating Characters 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 lengt…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 遍历子串 日期 [LeetCode] 题目地址:https://leetcode.com/problems/repeated-substring-pattern/ Difficulty: Easy 题目描述 Given a non-empty string check if it can be constructed by taking a subs…
idea: 设置一个hashset存储非重复元素 j:遍历s i:最近的一个非重复指针 注意点: 1.Set set = new HashSet<>(); add remove public int lengthOfLongestSubstring(String s) { int i = 0, j = 0, max = 0; Set<Character> set = new HashSet<>(); while(j < s.length()){ if(! set.…
1.java语言的字符串序列是通过字符串类实现的.java提供了3个字符串类:String类.StringBuilder类和StringBuffer类.String类是不变字符串,StringBuffer类和StringBuilder类是可变字符串,这3种字符串都是16位的Unicode字符序列,并且这3个类都被声明为final类,因此不能被继承. 2.字符串的比较: 程序代码: public class Compare { /** * @param args */ public st…