Earliest Finish Time for Land and Water Rides

Problem Statement There are \(L\) possible land rides and \(W\) possible water rides, with \(1 \le L, W \le 5 \times 10^4\). A tourist must experience exactly one ride from each category, in either order. A ride may be started at its opening time or any later moment. Immediately after finishing one ride, the tourist may board the other if it&rsquo;s already open or wait until it opens. Return the…