-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 70b8c15
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 0003 无重复字符的最长字串 | ||
这道题让我想起了算法课讲起的一个问题,什么样的问题适合用分治,什么样的问题适合用递归。 | ||
|
||
## 问题描述 | ||
给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 | ||
|
||
示例 1: | ||
|
||
输入: "abcabcbb" | ||
输出: 3 | ||
解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。 | ||
|
||
示例 2: | ||
|
||
输入: "bbbbb" | ||
输出: 1 | ||
解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。 | ||
|
||
示例 3: | ||
|
||
输入: "pwwkew" | ||
输出: 3 | ||
解释: 因为无重复字符的最长子串是 "wke",所以其长度为 3。 | ||
请注意,你的答案必须是 子串 的长度,"pwke" 是一个子序列,不是子串。 | ||
|
||
来源:力扣(LeetCode) | ||
链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters | ||
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 | ||
|
||
## 解题思路 | ||
采用 分治法 果然最难的是如何合并两个分支。 做到两点也没做出来 |