Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Workflow Engine for Self-Help Menu
00:00
5 left

Workflow Engine for Self-Help Menu

HardPython

Problem

Build a workflow engine to automate DoorDash's self-help menu: given stubbed Workflow (DAG of START/END/IS_LATE/FULL_REFUND nodes), MockDoorDashAPI (get_order, get_current_eta, issue_refund) and WorkflowEngine.execute_workflow(workflow, order_id), implement the stubs (get_start_node, from_txt, execute_workflow) so the provided test passes.

Asked in the onsite - AI Code Craft stage. Use AI tooling locally; prompt engineering is evaluated. Reported follow-ups include partial refunds for slightly late orders and investigating 10-20 second execution time.

Input and Output

Implement execute_workflow(workflow, order_id). workflow is a JSON object with definition, orders, and current_etas. Return true when a FULL_REFUND node is reached and false otherwise. A late order has current_eta > promised_eta.

Constraints

  • workflow["definition"] contains one node per nonempty line.
  • Node types are START, END, IS_LATE, and FULL_REFUND.
  • There is at most one START node.
  • Each valid workflow is a DAG.
  • Each order contains an integer promised_eta, and each current ETA is an integer.

Function Signature

def execute_workflow(workflow, order_id):
Interviewer

Your question is Workflow Engine for Self-Help Menu. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.