Insert Intervals Leetcode Two Sum Solution Javascript