A space station network has two major hubs, Alpha and Beta, connected by shuttle services. Shuttles from Alpha to Beta take 100 time units and depart according to a sorted integer array alpha2beta. Similarly, shuttles from Beta to Alpha also take 100 time units and depart at times specified in a sorted integer array beta2alpha. You need to complete missions where each mission requires traveling from Alpha to Beta and back to Alpha. Calculate the time unit when you will complete all missions, assuming you always take the earliest available shuttle. It is guaranteed that it is possible to complete all missions using the provided shuttle schedules. All times are measured in time units from the start of your journey. Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(trips × (alpha2beta.length × max(alpha2beta) + beta2alpha.length × max(beta2alpha))) will fit within the execution time limit.
Salesforce • Pending