mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 23:41:41 +08:00
update
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<p>Given a string <code>s</code>, return the maximum number of ocurrences of <strong>any</strong> substring under the following rules:</p>
|
||||
|
||||
<ul>
|
||||
<li>The number of unique characters in the substring must be less than or equal to <code>maxLetters</code>.</li>
|
||||
<li>The substring size must be between <code>minSize</code> and <code>maxSize</code> inclusive.</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "aababcaab", maxLetters = 2, minSize = 3, maxSize = 4
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> Substring "aab" has 2 ocurrences in the original string.
|
||||
It satisfies the conditions, 2 unique letters and size 3 (between minSize and maxSize).
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "aaaa", maxLetters = 1, minSize = 3, maxSize = 3
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> Substring "aaa" occur 2 times in the string. It can overlap.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>1 <= maxLetters <= 26</code></li>
|
||||
<li><code>1 <= minSize <= maxSize <= min(26, s.length)</code></li>
|
||||
<li><code>s</code> consists of only lowercase English letters.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user