Yes, you are right both are slightly different approaches.

Although we are trying to do the same thing i.e. trying to find the best incoming and outgoing wormhole for each contest and finding which takes minimum time.

In the approach for which Keshav has given hints, we sort contests by starting time and then we can compute best incoming wormhole in linear time for each contest.

Similarly to compute best outgoing wormhole we sort the contests by ending time.