Earliest Finish Time for Land and Water Rides II

Solution Code

Time Complexity

O(n + m)

Space Complexity

O(1)