Smallest Substring Of All Characters Leetcode Javascript