← Booking.com Interview Insights

Booking.com·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Got a coding question at Booking.com that was more about data wrangling and scoring logic than classic algorithms. Pretty applied, which I wasn't expecting.

Questions Asked (1)

Q1

Given a list of hotels and their associated reviews, where each review contains keywords that are either positive or negative, compute a total score for each hotel by aggregating keyword scores across all its reviews. Return the top-K hotels ranked by total score. You define the scoring weights and keyword detection logic.

Algorithms & Data StructuresProduct Analytics & Metrics
Author's notes

The open-ended part threw me a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: define how keywords map to scores (e.g., positive +1, negative -1), how to detect keywords in reviews (e.g., tokenization and lookup in a dictionary), and how to aggregate scores per hotel. Then outline an efficient algorithm: iterate through each review, compute its score, accumulate per hotel, and finally sort hotels by total score to extract top-K using a heap or sorting.

Pro tip: Mention that you would preprocess the keyword list into a hash set for O(1) lookups and consider using a min-heap of size K to avoid sorting all hotels, which is crucial for large datasets. Also, discuss handling ties and potential normalization by review count to avoid bias toward hotels with many reviews.

1. Clarify requirements and define scoring

Ask clarifying questions about keyword detection (exact match, case sensitivity, stemming), scoring weights (e.g., +1 for positive, -1 for negative), and whether to normalize by number of reviews. Define the output format: list of top-K hotels with their scores.

2. Design data structures and preprocessing

Store keywords in a hash set for O(1) lookup. Use a hash map to accumulate scores per hotel. If K is much smaller than the number of hotels, use a min-heap of size K to track top hotels.

3. Process reviews and compute scores

For each review, tokenize the text (e.g., split on whitespace and punctuation), check each token against the keyword set, and update the hotel's score. Handle multiple occurrences of the same keyword in a review (e.g., count each occurrence or only once).

4. Rank and extract top-K

After processing all reviews, sort hotels by score descending (or use a heap) and return the top K. If scores tie, define a tie-breaking rule (e.g., alphabetical order or higher review count).

5. Analyze complexity and edge cases

Discuss time complexity: O(R * L + H log H) where R is number of reviews, L average review length, H number of hotels; or O(R * L + H log K) with heap. Mention edge cases: no reviews, empty keyword list, K larger than number of hotels, and negative scores.

Key Points to Mention

  • Keyword detection: tokenization, case insensitivity, handling punctuation, and potential stemming/lemmatization.
  • Scoring weights: define positive/negative weights, consider weighting by keyword importance or sentiment strength.
  • Aggregation: sum scores per hotel, possibly normalize by number of reviews to avoid bias.
  • Efficiency: use hash maps for O(1) lookups, min-heap for top-K to avoid full sort.
  • Tie-breaking: define a deterministic rule for equal scores.
  • Scalability: discuss distributed processing (e.g., MapReduce) if data is large.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.