Skip to content

Commit 32efd65

Browse files
authored
Add files via upload
1 parent 11247dd commit 32efd65

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

459. Repeated Substring Pattern.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution {
2+
public:
3+
bool repeatedSubstringPattern(string s) {
4+
string doubled = s + s; // Step 1: Concatenate s with itself
5+
return doubled.substr(1, 2 * s.size() - 2).find(s) != string::npos; // Step 2 & 3
6+
}
7+
};

0 commit comments

Comments
 (0)