File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 14
14
264|[ Ugly Number II] ( ./0264-ugly-number-ii.js ) |Medium|
15
15
387|[ First Unique Character in a String] ( ./0387-first-unique-character-in-a-string.js ) |Easy|
16
16
451|[ Sort Characters By Frequency] ( ./0451-sort-characters-by-frequency.js ) |Medium|
17
+ 459|[ Repeated Substring Pattern] ( ./0459-repeated-substring-pattern.js ) |Easy|
17
18
606|[ Construct String from Binary Tree] ( ./0606-construct-string-from-binary-tree.js ) |Easy|
18
19
617|[ Merge Two Binary Trees] ( ./0617-merge-two-binary-trees.js ) |Easy|
19
20
648|[ Replace Words] ( ./0648-replace-words.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 459. Repeated Substring Pattern
3
+ * https://leetcode.com/problems/repeated-substring-pattern/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given a non-empty string check if it can be constructed by taking a
7
+ * substring of it and appending multiple copies of the substring
8
+ * together. You may assume the given string consists of lowercase
9
+ * English letters only and its length will not exceed 10000.
10
+ */
11
+
12
+ /**
13
+ * @param {string } s
14
+ * @return {boolean }
15
+ */
16
+ var repeatedSubstringPattern = function ( s ) {
17
+ return ( s + s ) . slice ( 1 , s . length * 2 - 1 ) . indexOf ( s ) !== - 1 ;
18
+ } ;
You can’t perform that action at this time.
0 commit comments