PhonePe calls its LLD round machine coding — you build a real, working class design in 90–120 minutes, then defend it in a follow-up review focused on concurrency, thread safety, and how cleanly the design could be extended without a rewrite.
Design a workflow execution engine, similar in spirit to Apache Airflow, that runs a workflow defined as a directed acyclic graph (DAG) of tasks. Independent tasks should execute concurrently, failed tasks should retry automatically, and the engine should never re-run a task that already completed successfully before a crash.
Requirements to clarify first
- Is a task guaranteed to be idempotent by contract, or must the engine itself make a retried or replayed task safe to run twice?
- What does 'failed' mean for a task — an exception, a timeout, or a non-zero exit — and how many retries with what back-off before the whole workflow is marked failed?
- Does one workflow run fit in a single process (thread pool), or must several scheduler instances share the same DAG run and coordinate through a store?
More machine coding prompts PhonePe has asked recently
The class design, entity list, design-pattern reasoning and follow-up discussion for these — plus the full worked solution above — are part of the Placement-Ready PYQ Kit.
1 more machine coding prompts with full class designs in the full Placement-Ready PYQ Kit

