Non Overlapping Intervals Leetcode Javascript Interview