Skyscanner Interview Question

Write a pseudo-code with the most efficient algorithm possible for a particular puzzle.