一、题目叙述:
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 "pwwkew"
, the answer is "wke"
, with the length of 3. Note that the answer must be a substring, "pwke"
is a subsequence and not a substring.
二、解题思路:
哎呦,我有个疑问?Leetcode上到底会不会超时呀?为什么我做这道题,完全算是暴力,为什么还通过了?奇怪!好啦,抽空重新换个复杂度低点的算法。目前这个算法就是暴力一个一个比较,得到最长字串长度,并没有什么思路可言。。。
三、源源源码(复杂度超高):