1
var repeatedSubstringPattern = function (s) {
2
let repeatStr = s.repeat(2); //first duplicate the string with repeat function
3
let sliceStr = repeatStr.slice(1, -1); // slice string first and last string word
4
return sliceStr.includes(s); // now check if the main string(s) is included by sliced string
5
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0