Longest Substring Without Repeating Characters
题目
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.
题解
/**
问题描述:
给定一个字符串,找到最长的没有重复字符的子串
问题示例:
"abcabcbb" -----> "abc"
"bbbbb" -----> "b"
"pwwkew" -----> "wke"
问题重点:
1. 最长子串
2. 无重复字符
问题疑点:
解题思路:
1. 遍历每个字符和自己之后的字符做对比,
2. 获取步长最长的字符的下标
*/
// Version 1
class Solution_v1 {
public String lenthOfLongestSubString(String str){
}
}
/**
问题总结:
*/
/**---------------------------------------------- */
/**
解题思路:
*/
// version 2
class Solution_v2 {
}
/**
算法总结:
*/
/**
*
* 算法测试
*
*/
class Test {
public static void main(String[] args) {
System.out.println("测试结果");
String str = "abacdefgeabcdef";
}
}