Minimum Length Substrings Leetcode Javascript Question