演算法:3. Longest Substring Without Repeating Characters
03-03
題目來自:
Longest Substring Without Repeating CharactersGiven 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.
思路:
時間複雜度:O(n)
空間複雜度:O(n)
推薦閱讀:
※演算法教練談談碼工面試
※021 Merge Two Sorted Lists[E]
※機器學慣用於金融市場預測難在哪?
※調整數組順序使奇數位於偶數前面
※剪繩子
TAG:演算法 |