Count Unique Substring Leetcode Javascript Practice