We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c4ec13 commit 8e089e3Copy full SHA for 8e089e3
RotateString.java
@@ -0,0 +1,32 @@
1
+public class RotateString {
2
+ public static void main(String[] args) {
3
+ System.out.println(rotateString("", ""));
4
+ }
5
+
6
+ //my solution
7
+ public static boolean rotateString(String A, String B) {
8
+ boolean flag = false;
9
10
+ if (A.length() != B.length())
11
+ return flag;
12
+ else if (A.length() == 0 && B.length() == 0)
13
+ return true;
14
15
+ for (int i = 1; i < A.length(); i++) {
16
+ if (A.contains(B.substring(0, i)) && A.contains(B.substring(i, B.length())))
17
+ flag = true;
18
+ else
19
+ continue;
20
21
22
23
+}
24
25
+// best solution
26
+/*
27
+class Solution {
28
+ public boolean rotateString(String A, String B) {
29
+ return A.length() == B.length() && (A + A).contains(B);
30
31
32
+ */
0 commit comments