Booking.com interview question

Sliding window and greedy algorithm