Parallel Task Batching
Snapchat interview questions · Medium · Coding round · 6 tests
You need to run a collection of tasks, some of which depend on others. A dependency written as
[A, B] says that B cannot begin until A has completed.
Assume there is no limit on how many tasks can run concurrently, so any task whose prerequisites
are all done joins the current batch.
Interface
scheduleTaskBatches(
tasks: string[],
dependencies: Array<[string, string]>,
): string[][] | nullRun your code with Ctrl+Enter to see results.