Merge overlapping intervals | Meta Interview Question