Title: #1668 - Maximum Repeating Substring - LeetCode JavaScript Solutions
Open Graph Title: #1668 - Maximum Repeating Substring - LeetCode JavaScript Solutions
X Title: #1668 - Maximum Repeating Substring - LeetCode JavaScript Solutions
Description: For a string sequence, a string word is k-repeating if word concatenated k times is a substring of sequence. The word's maximum k-repea...
Open Graph Description: For a string sequence, a string word is k-repeating if word concatenated k times is a substring of sequence. The word's maximum k-repea...
X Description: For a string sequence, a string word is k-repeating if word concatenated k times is a substring of sequence. The word's maximum k-repea...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/maximum-repeating-substring
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/maximum-repeating-substring","name":"#1668 - Maximum Repeating Substring - LeetCode JavaScript Solutions","description":"For a string sequence, a string word is k-repeating if word concatenated k times is a substring of sequence. The word's maximum k-repea...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string} sequence\n * @param {string} word\n * @return {number}\n */\nvar maxRepeating = function(sequence, word) {\n let count = Math.floor(sequence.length / word.length) + 1;\n while (--count) {\n if (sequence.includes(word.repeat(count))) return count;\n }\n return count;\n};","keywords":"LeetCode 1668, #1668 - Maximum Repeating Substring, Easy, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/maximum-repeating-substring |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/maximum-repeating-substring/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/1668-maximum-repeating-substring.js |
| String | https://leetcodejavascript.com/tags/string |
| Dynamic Programming | https://leetcodejavascript.com/tags/dynamic-programming |
| String Matching | https://leetcodejavascript.com/tags/string-matching |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow