Match Bookings to Payments
Booking.comSoftware Engineer · OnsiteLast updated
This question evaluates skill in matching records across unsorted collections, focusing on data structures, aggregation and handling one-to-one and one-to-many relationships between bookings and payments.
You are given two unsorted lists:
bookings: each record contains at least a uniquebooking_idpayments: each record contains at least abooking_idindicating which booking the payment belongs to
For each booking, determine whether a payment has been made for that booking.
Clarify your expected output, for example:
- return a boolean for a single booking, or
- return a mapping/list showing whether each booking has at least one matching payment
Follow-up:
- How would your approach change if one booking can have multiple payment records?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.