solve insert interval, maximum subarray and merge intervals