Skyscanner interview question

Standard algorithm questins, fairly straightforward (leetcode easy)