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)/字符至少出现 K 次的子字符串 I [count-substrings-with-k-frequency-characters-i].html
2024-11-07 00:20:26 +08:00

47 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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>给你一个字符串 <code>s</code> 和一个整数 <code>k</code>,在 <code>s</code> 的所有子字符串中,请你统计并返回 <strong>至少有一个 </strong>字符 <strong>至少出现</strong> <code>k</code> 次的子字符串总数。</p>
<p><strong>子字符串 </strong>是字符串中的一个连续、<b> 非空</b> 的字符序列。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">s = "abacb", k = 2</span></p>
<p><strong>输出:</strong> <span class="example-io">4</span></p>
<p><strong>解释:</strong></p>
<p>符合条件的子字符串如下:</p>
<ul>
<li><code>"aba"</code>(字符 <code>'a'</code> 出现 2 次)。</li>
<li><code>"abac"</code>(字符 <code>'a'</code> 出现 2 次)。</li>
<li><code>"abacb"</code>(字符 <code>'a'</code> 出现 2 次)。</li>
<li><code>"bacb"</code>(字符 <code>'b'</code> 出现 2 次)。</li>
</ul>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">s = "abcde", k = 1</span></p>
<p><strong>输出:</strong> <span class="example-io">15</span></p>
<p><strong>解释:</strong></p>
<p>所有子字符串都有效,因为每个字符至少出现一次。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 3000</code></li>
<li><code>1 &lt;= k &lt;= s.length</code></li>
<li><code>s</code> 仅由小写英文字母组成。</li>
</ul>