0 day streak
Anonymous · shared experience20 Jun 2025 · 9 views

Booking.com: Spring Boot service: hotel CRUD plus three nearest hotels to a city

Interview question #Booking.com SDE 2 Machine coding

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

  1. Expose standard create, read, update and delete endpoints for hotels.
  2. Add an endpoint that, given a city, returns the three hotels closest to it.
  3. 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.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.