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)/统计重复个数 [count-the-repetitions].html
2022-03-29 12:43:11 +08:00

42 lines
1.5 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>定义 <code>str = [s, n]</code> 表示 <code>str</code><code>n</code> 个字符串 <code>s</code> 连接构成。</p>
<ul>
<li>例如,<code>str == ["abc", 3] =="abcabcabc"</code></li>
</ul>
<p>如果可以从 <code>s2</code><sub> </sub>中删除某些字符使其变为 <code>s1</code>,则称字符串 <code>s1</code><sub> </sub>可以从字符串 <code>s2</code> 获得。</p>
<ul>
<li>例如,根据定义,<code>s1 = "abc"</code> 可以从 <code>s2 = "ab<em><strong>dbe</strong></em>c"</code> 获得,仅需要删除加粗且用斜体标识的字符。</li>
</ul>
<p>现在给你两个字符串 <code>s1</code> 和 <code>s2</code> 和两个整数 <code>n1</code><code>n2</code> 。由此构造得到两个字符串,其中 <code>str1 = [s1, n1]</code><code>str2 = [s2, n2]</code></p>
<p>请你找出一个最大整数 <code>m</code> ,以满足 <code>str = [str2, m]</code> 可以从 <code>str1</code> 获得。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s1 = "acb", n1 = 4, s2 = "ab", n2 = 2
<strong>输出:</strong>2
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>s1 = "acb", n1 = 1, s2 = "acb", n2 = 1
<strong>输出:</strong>1
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= s1.length, s2.length <= 100</code></li>
<li><code>s1</code><code>s2</code> 由小写英文字母组成</li>
<li><code>1 <= n1, n2 <= 10<sup>6</sup></code></li>
</ul>