Practice · 1 of 2
Fan-out workers
CHALLENGE
Difficulty: advanced+25 XP
Implement static async Task<int[]> FanOut(int itemCount, int workers) where itemCount jobs (value = index) flow through a channel and workers concurrent consumer tasks each pull items and compute index * 2, writing results into a shared thread-safe list. All items must be processed exactly once (competing consumers on one channel), and the method returns the sorted results. The test runs workers=4 over 1000 items and asserts completeness and uniqueness.
Press Submit to check your solution.
Back to lesson: Practice: Channel drills