Pinterest interview question

Medium level leetcode question, overlapping intervals