Interval Scheduling Problem Leetcode Javascript Solution