File tree 1 file changed +1
-14
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +1
-14
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .HashSet ;
4
4
import java .util .Set ;
5
5
6
- /**
7
- * 686. Repeated String Match
8
- *
9
- * Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it.
10
- * If no such solution, return -1.
11
- * For example, with A = "abcd" and B = "cdabcdab".
12
- * Return 3, because by repeating A three times (“abcdabcdabcd”),
13
- * B is a substring of it; and B is not a substring of A repeated two times ("abcdabcd").
14
-
15
- Note:
16
- The length of A and B will be between 1 and 10000.
17
- */
18
-
19
6
public class _686 {
20
7
public static class Solution1 {
21
8
public int repeatedStringMatch (String A , String B ) {
@@ -43,7 +30,7 @@ public static class Solution2 {
43
30
/**
44
31
* Time: O(N(N+M))
45
32
* Space: O(N + M)
46
- * * /
33
+ */
47
34
public int repeatedStringMatch (String A , String B ) {
48
35
int count = 1 ;
49
36
StringBuilder sb = new StringBuilder (A );
You can’t perform that action at this time.
0 commit comments