1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-27 10:40:26 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/统计重复个数 [count-the-repetitions].html

42 lines
1.5 KiB
HTML
Raw Normal View History

2022-03-27 20:52:13 +08:00
<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>