Airbnb Interview Question

Variant of a Leetcode hard problem