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)/最大重复子字符串 [maximum-repeating-substring].html
2022-03-29 12:43:11 +08:00

40 lines
1.6 KiB
HTML
Raw Permalink 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>给你一个字符串 <code>sequence</code> ,如果字符串 <code>word</code> 连续重复 <code>k</code> 次形成的字符串是 <code>sequence</code> 的一个子字符串,那么单词 <code>word</code><strong>重复值为 <code>k</code></strong><strong> </strong>。单词 <code>word</code> 的 <strong></strong><strong>大重复值</strong> 是单词 <code>word</code> 在 <code>sequence</code> 中最大的重复值。如果 <code>word</code> 不是 <code>sequence</code> 的子串,那么重复值 <code>k</code> 为 <code>0</code></p>
<p>给你一个字符串 <code>sequence</code> 和 <code>word</code> ,请你返回 <strong>最大重复值 <code>k</code> </strong></p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>sequence = "ababc", word = "ab"
<b>输出:</b>2
<strong>解释:</strong>"abab" 是 "<strong>abab</strong>c" 的子字符串。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>sequence = "ababc", word = "ba"
<b>输出:</b>1
<strong>解释:</strong>"ba" 是 "a<strong>ba</strong>bc" 的子字符串,但 "baba" 不是 "ababc" 的子字符串。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<b>输入:</b>sequence = "ababc", word = "ac"
<b>输出:</b>0
<strong>解释:</strong>"ac" 不是 "ababc" 的子字符串。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= sequence.length <= 100</code></li>
<li><code>1 <= word.length <= 100</code></li>
<li><code>sequence</code> 和 <code>word</code> 都只包含小写英文字母。</li>
</ul>