Minimum Length Substrings Leetcode Java