Booking.com: Spring Boot service: hotel CRUD plus three nearest hotels to a city
Setup. A ready-made Spring Boot project with an in-memory H2 database already filled with data. JPA entities and repositories for Hotel and City exist, and both tables store latitude and longitude.
Tasks
- Expose standard create, read, update and delete endpoints for hotels.
- Add an endpoint that, given a city, returns the three hotels closest to it.
- Add unit tests where needed.
Hint given. Use the Haversine formula to compute distance between two latitude/longitude points.
Context. This was the online assessment for an SDE 2 role in Bengaluru. Later rounds were a system design for hotel ratings and reviews (search and filter by rating, rate, review) and a DSA round on enumerating city-hopping trip costs under a budget.
What to prepare. No grading criteria were shared. Clean layering (controller, service, repository), sensible validation and status codes, and a tidy nearest-three query (computing distances and keeping the top three, rather than sorting everything if data grows) are the obvious things to get right.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.