Class Solution
-
- All Implemented Interfaces:
public final class Solution466 - Count The Repetitions.
Hard
We define
str = [s, n]as the stringstrwhich consists of the stringsconcatenatedntimes.For example,
str == ["abc", 3] =="abcabcabc".
We define that string
s1can be obtained from strings2if we can remove some characters froms2such that it becomess1.For example,
s1 = "abc"can be obtained from <code>s2 = "ab**<ins>dbe</ins>**c"</code> based on our definition by removing the bolded underlined characters.
You are given two strings
s1ands2and two integersn1andn2. You have the two stringsstr1 = [s1, n1]andstr2 = [s2, n2].Return the maximum integer
msuch thatstr = [str2, m]can be obtained fromstr1.Example 1:
Input: s1 = "acb", n1 = 4, s2 = "ab", n2 = 2
Output: 2
Example 2:
Input: s1 = "acb", n1 = 1, s2 = "acb", n2 = 1
Output: 1
Constraints:
1 <= s1.length, s2.length <= 100s1ands2consist of lowercase English letters.<code>1 <= n1, n2 <= 10<sup>6</sup></code>
-
-
Constructor Summary
Constructors Constructor Description Solution()
-