1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/长度为三且各字符不同的子字符串 [substrings-of-size-three-with-distinct-characters].html
2022-03-29 12:43:11 +08:00

37 lines
1.2 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>如果一个字符串不含有任何重复字符,我们称这个字符串为 <strong></strong> 字符串。</p>
<p>给你一个字符串 <code>s</code> ,请你返回 <code>s</code> 中长度为 <strong>3</strong> 的 <strong>好子字符串</strong> 的数量。</p>
<p>注意,如果相同的好子字符串出现多次,每一次都应该被记入答案之中。</p>
<p><strong>子字符串</strong> 是一个字符串中连续的字符序列。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>s = "xyzzaz"
<b>输出:</b>1
<b>解释:</b>总共有 4 个长度为 3 的子字符串:"xyz""yzz""zza" 和 "zaz" 。
唯一的长度为 3 的好子字符串是 "xyz" 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>s = "aababcabc"
<b>输出:</b>4
<b>解释:</b>总共有 7 个长度为 3 的子字符串:"aab""aba""bab""abc""bca""cab" 和 "abc" 。
好子字符串包括 "abc""bca""cab" 和 "abc" 。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= s.length <= 100</code></li>
<li><code>s</code> 只包含小写英文字母。</li>
</ul>