Skip to content

Commit c69cb76

Browse files
committed
cpp
1 parent bed7eff commit c69cb76

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Solution {
2+
public:
3+
bool repeatedSubstringPattern(string s) {
4+
int len=s.length();
5+
for(int i=len/2;i>=1;i--){
6+
string final="";
7+
if(len%i==0){
8+
string temp=s.substr(0,i);
9+
10+
for(int j=0;j<len/i;j=j+1){
11+
final+=temp;
12+
}
13+
}
14+
if(final==s){
15+
return 1;
16+
}
17+
}
18+
return 0;
19+
}
20+
};

0 commit comments

Comments
 (0)