Leetcode 459 Solution
This article provides solution to leetcode question 459 (repeated-substring-pattern)
Access this page by simply typing in "lcs 459" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/repeated-substring-pattern
Solution
class Solution {
public:
bool repeatedSubstringPattern(string str) {
if (str.size() == 0)
return false;
string str2 = str.substr(1, str.size() - 1) + str.substr(0, str.size() - 1);
return strstr(str2.c_str(), str.c_str());
}
};