DoorDash VO Interview — Recommend Similar Items | Recommendation Ranking | Sorting | Distance Metric

30 Views
No Comments

DoorDash uses machine learning to recommend users items that are similar to ones they have ordered before. Each item is assigned an integer score, and the similarity between two items is defined by how close their scores are.

Given:

  • A list of item scores: items
  • An integer mostSimilarItems (the number of recommendations to return)
  • An integer item (the target item score)

Return the mostSimilarItems items that are closest in score to the target score.

The smaller the absolute difference |items[i] - item|, the more similar the items are.
If two items have the same difference, the smaller score should come first.

You must return the results sorted by similarity.


Example 1

items = [1, 2, 3, 4, 5]
mostSimilarItems = 4
item = 3

Return:

[1, 2, 3, 4]

(These are the four closest values to 3 by absolute difference.)


This DoorDash VO problem evaluates a candidate’s ability to implement a basic ranking function for recommendations. The similarity metric is defined as the absolute difference between item scores, and the goal is to return the top k items closest to a given score.

Key expectations:

  • Use a stable and deterministic rule for ordering:
    1. Sort by abs(score - target)
    2. Tie-break by the actual score (smaller first)
  • Avoid unnecessary data structures; sorting is sufficient.
  • Understand this is a simplified version of how recommendation systems often compute nearest items.
  • Demonstrate clean reasoning and predictable output ordering.

Time complexity is dominated by sorting: O(n log n).

The VOprep team has long accompanied candidates through various major company OAs and VOs, including Doordash, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Tiktok or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.

END
 0