Maximum Repeating Substring Leetcode Javascript Interview