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 2f1de8d commit f412550Copy full SHA for f412550
leetcode/cpp/string/459.cpp
@@ -0,0 +1,33 @@
1
+class Solution {
2
+public:
3
+ bool repeatedSubstringPattern(string s) {
4
+ string t="";
5
+ if(s.size()==1)
6
+ {
7
+ return false;
8
+ }
9
+ int n=s.size();
10
+ for(int i=0;i<s.size()/2;i++)
11
12
+ t+=s[i];
13
+ // cout<<t<<endl;
14
+ int x=t.size();
15
+ if(n%x==0)
16
17
+ string res;
18
+ for(int j=0;j<n/x;j++)
19
20
+ res+=t;
21
22
+ if(res==s)
23
24
+ // cout<<res;
25
+ return true;
26
+
27
28
29
30
31
32
33
+};
0 commit comments