Skyscanner interview question

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