Count Distinct Substrings Leetcode Javascript Interview