这题的题意大概就是给你一个字符串"abcdecde",找到最长的子字符串长度,里面所有的子母都不重复.本例子中最长的满足条件的子字符串就是"abcde",所以应该返回的是5.这一题如果不用暴力解决的方法的话,我优先想到的数据结构是HashMap,因为它能够判断字母是否重复,并且记录每个字母的index.而现在唯一的难点就是,怎么通过HashMap来找到这个最长字符串.因为要记录子字符串的长度,从而,肯定需要两个index,一个index1作为子字符串的头,另一个in…
一天一道LeetCode (一)题目 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"…
题目链接:https://leetcode.com/problems/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&qu…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 公众号:负雪明烛 本文关键词:无重复字符,最长子串,题解,leetcode, 力扣,python, c++, java 目录 题目描述 题目大意 解题方法 解法一:虫取法+set 方法二:一次遍历+字典 日期 题目地址:https://leetcode.com/problems/longest-substring-without-repeating-characters/descrip…
题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of…
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of 1.…
题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of…
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…
我现在在做一个叫<leetbook>的免费开源书项目,力求提供最易懂的中文思路,目前把解题思路都同步更新到gitbook上了,需要的同学可以去看看 书的地址:https://hk029.gitbooks.io/leetbook/ 003. Longest Substring Without Repeating Characters[M] Longest Substring Without Repeating CharactersM 题目 思路 代码 题目 Given a string, fin…
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 subst…