Compute the End of Day Batch Window From Job Dependencies
Last updated: November 29, 2026
Quick Overview
Given end-of-day banking batch jobs with durations and must-run-before dependencies, and unlimited parallel workers, return the minimum time to finish all jobs and a valid run order, or report that the dependencies contain a cycle.
Infosys
November 29, 20260
0
0 solved
Given end-of-day banking batch jobs with durations and must-run-before dependencies, and unlimited parallel workers, return the minimum time to finish all jobs and a valid run order, or report that the dependencies contain a cycle.
Core banking platforms like Finacle run a nightly EOD sequence (interest accrual, fee posting, GL posting, statements) that must fit a fixed window before the bank reopens. An Infosys technical interviewer would use this to see whether you recognize a DAG, use topological order, and derive the critical path rather than just summing durations.
What the Interviewer Expects
- Model jobs and dependencies as a directed graph
- Use Kahn's algorithm or DFS for topological order
- Compute earliest start and finish times along the order
- Detect and report cycles explicitly
- State linear complexity in jobs plus dependencies
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also return the critical path itself?
- If only W workers are available, how does the problem change and what heuristic would you use?
- A job fails halfway. How would you restart only what is affected?
- How would you compute the latest start time for each job so ops knows the slack?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: durations mapping job to minutes, and deps as pairs (a, b) meaning b cannot start until a finishes. Workers are unlimited, so a job starts the moment its last prerequisite finishes. Outpu...
High-Level Design
With unlimited parallelism, the answer is the longest weighted path through the DAG (the critical path). Process jobs in topological order using Kahn's algorithm: keep in-degrees, start with jobs that...