Generate split-stay pairs efficiently | Airbnb Coding Question