1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最长不含重复字符的子字符串 [zui-chang-bu-han-zhong-fu-zi-fu-de-zi-zi-fu-chuan-lcof].html

36 lines
1.3 KiB
HTML
Raw Normal View History

2022-03-27 20:38:29 +08:00
<p>请从字符串中找出一个最长的不包含重复字符的子字符串,计算该最长子字符串的长度。</p>
<p>&nbsp;</p>
<p><strong>示例&nbsp;1:</strong></p>
<pre><strong>输入: </strong>&quot;abcabcbb&quot;
<strong>输出: </strong>3
<strong>解释:</strong> 因为无重复字符的最长子串是 <code>&quot;abc&quot;,所以其</code>长度为 3。
</pre>
<p><strong>示例 2:</strong></p>
<pre><strong>输入: </strong>&quot;bbbbb&quot;
<strong>输出: </strong>1
<strong>解释: </strong>因为无重复字符的最长子串是 <code>&quot;b&quot;</code>,所以其长度为 1。
</pre>
<p><strong>示例 3:</strong></p>
<pre><strong>输入: </strong>&quot;pwwkew&quot;
<strong>输出: </strong>3
<strong>解释: </strong>因为无重复字符的最长子串是&nbsp;<code>&quot;wke&quot;</code>,所以其长度为 3。
&nbsp; 请注意,你的答案必须是 <strong>子串 </strong>的长度,<code>&quot;pwke&quot;</code>&nbsp;是一个<em>子序列,</em>不是子串。
</pre>
<p>&nbsp;</p>
<p>提示:</p>
<ul>
<li><code>s.length &lt;= 40000</code></li>
</ul>
<p>注意:本题与主站 3 题相同:<a href="https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/">https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/</a></p>