L4 DSA Rond question:
You are given a list of packages to compile, along with two APIs: getDependencies and compile (you can treat both as simple method calls).
The goal is to compile all the packages in a multithreaded environment. A package can only be compiled after all of its dependencies have been successfully compiled.
This problem is similar to https://leetcode.com/problems/course-schedule-ii/description/, but with the added complexity of multithreading.
Points to consider:
- getDependencies may return packages that are not in the original list. These must also be handled and compiled.
- Your solution should detect and handle circular dependencies.
- Thread count should be configurable
What is the best way to solve this?
Comments (5)

