Design Leetcode Problems Javascript Substring