Doordash Phone Screen | USA | E4 | Rejected

doordash logo
doordash
E4USA
April 2, 20252 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.

Full Experience

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

Interview Questions (1)

Q1
Modified LRU Cache for Dasher Assignments
Data Structures & AlgorithmsHard

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

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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