Tap here to switch tabs
Problem
Submissions

Problem: Count The Repetitions

med
30 min
Try to solve the Count The Repetitions problem.

Statement

We define str = [s, n] as the string s concatenated nn times.

For example, str = ["abc", 3] is equal to "abcabcabc".

We say that a string t can be obtained from a string s if some characters in s can be deleted so that the remaining string equals t.

Given two strings s1 and s2 and two integers n1 and n2, let str1 = [s1, n1] and str2 = [s2, n2]. Return the maximum integer m such that [str2, m] can be obtained from str1.

Constraints:

  • 1≤1 \leq s1.length, s2.length ≤100\leq 100

  • s1 and s2 consist of lowercase English letters.

  • 1≤1 \leq n1, n2 ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count The Repetitions

med
30 min
Try to solve the Count The Repetitions problem.

Statement

We define str = [s, n] as the string s concatenated nn times.

For example, str = ["abc", 3] is equal to "abcabcabc".

We say that a string t can be obtained from a string s if some characters in s can be deleted so that the remaining string equals t.

Given two strings s1 and s2 and two integers n1 and n2, let str1 = [s1, n1] and str2 = [s2, n2]. Return the maximum integer m such that [str2, m] can be obtained from str1.

Constraints:

  • 1≤1 \leq s1.length, s2.length ≤100\leq 100

  • s1 and s2 consist of lowercase English letters.

  • 1≤1 \leq n1, n2 ≤106\leq 10^6