I recently gave a phone screen for Meta's Machine Learning Engineer position and have been advanced to the On-Site. To give back to the community that has greatly aided my preparation,
For instance, consider the arrays departure = [10, 3, 10, 9, 3] and return = [4, 20, 6, 7, 10]. The minimum cost for a valid pair is 3 + 6 = 9.
I provided optimal solutions for both problems and concluded the interview early. The second problem can be solved with O(N) time complexity and O(1) space complexity.