LuxuryEscapes interview question

Resolve an algorithm to improve performance