[USA] DoorDash Code Craft Round

Role: Midlevel SWE Role

Result: Passed the round

Codecraft round was not a leetcode style problem, but rather an exercise you do collaboratively with the interviewer. I found the discussion pretty good and in part, the interviewer was actually present and interested in hearing my thought process!

Problem

Overview

As part of migrating away from a monolith to a micro-service architecture your team has been tasked with building out a new Payments Service. Your project is to build out the Dasher payout logic. As part of your work you will need to call an upstream dependency to retrieve the relevant data.

Goals

  • Create an API with the following endpoint
    • POST payout
      • Input: dasherId
      • Output: dollar amount the dasher gets paid
      • This endpoint needs to request delivery information from a separate endpoint

Requirements

  • The first version of the payment model is naively based on how much time the Dasher spends fulfilling each order. Given the sequence of order activities from a given Dasher on a given day, calculate the Dasher pay based on the following payment rules:
    • base pay rate: $0.3 per minute
    • multi order pay rate: # ongoing deliveries * base pay rate
    • test coverage

Calculate how much to pay out for the Dasher

Service needs to contain logic how much to pay for dashboard according to external data from another service. For the purpose of this exercise, you can mock the data and create a function to return the set of data

Gotchas

  • The interviewer asked me to come up with the mock data, but my representation matched what the interviewer had in mind, so the example data was provided.
  • There were no followup parts/features to this question! I was able to get a working implementation working so we spent time on edge cases and basic systems thinking

Followups

  1. Any edge cases you can think of in your implementation? Correct for those after discussing with the interviewer and test your code. Use your critical thinking here
  2. What would happen if the upstream service had high latency? What would you do?
Comments (8)