Async Control Flow
Implement Concurrency Limiter
hardJS SpecificJS / TS4 tests
Problem Statement
Implement a `ConcurrencyLimiter` class (or function) that manages async task execution, ensuring that no more than `maxConcurrency` tasks run simultaneously while queueing additional tasks.
Examples
Example:
const limiter = new ConcurrencyLimiter(2);
limiter.add(() => fetch('/api/1'));
limiter.add(() => fetch('/api/2'));
limiter.add(() => fetch('/api/3')); // Waits until 1 or 2 finishesJavaScript & TypeScript starter code included
Run this as a live interviewPractice solo
4 test cases. No second person needed.