Doordash Phone Screen | USA | E4 | Rejected

Location
USA
Posted
2 Apr 2025
350 reads

Summary

I had a phone screen for an E4 role at Doordash in the USA. I was rejected after the interview, which focused on a modification of the LRU cache problem.

How it went

Modification of LRU cache.

Alice, an engineer, notices that a database for dasher assignments is slowing down due to the number of dashers and entries in the database. She notices that recently assigned dashers are more likely to be looked up and would like to cache these dashers so that lookup is faster.

This database stores the most recent delivery that a dasher made (looking up a dasher returns a single delivery id that they were last assigned). Specifically, she would like the cache to support the following functions:

put(dasher_id: Int, delivery_id: Int). Adds the delivery that a dasher is working into the cache. If the dasher exists in the cache, then the delivery is updated (and this key, value pair is now the most recently used pair)

get(dasher_id: Int). Gets the most recent delivery for a dasher. Returns -1 if the dasher_id is not in the cache

The server only has space to store capacity dasher’s information in the cache. Alice decides that only the most recently updated dashers should be stored in the cache (ones that had put called most recently). When the cache goes above capacity, the oldest entry is removed from the cache. The cache is initialized with the following function:

init(capacity: Int). Initializes the cache with specified capacity

Questions asked (1)

  1. 01

    Modified LRU Cache for Dasher Assignments

    Data Structures & Algorithms · Hard

    Alice, an engineer, notices that a database for dasher assignments is slowing down due to the number of dashers and entries in the database. She notices that recently assigned dashers are more likely to be looked up and would like to cache these dashers so that lookup is faster. This database stores the most recent delivery that a dasher made (looking up a dasher returns a single delivery id that they were last assigned). Specifically, she would like the cache to support the following functions:

    put(dasher_id: Int, delivery_id: Int). Adds the delivery that a dasher is working into the cache. If the dasher exists in the cache, then the delivery is updated (and this key, value pair is now the most recently used pair)

    get(dasher_id: Int). Gets the most recent delivery for a dasher. Returns -1 if the dasher_id is not in the cache

    The server only has space to store capacity dasher’s information in the cache. Alice decides that only the most recently updated dashers should be stored in the cache (ones that had put called most recently). When the cache goes above capacity, the oldest entry is removed from the cache. The cache is initialized with the following function:

    init(capacity: Int). Initializes the cache with specified capacity

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at DoorDash recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!