← 返回 bytedance 的题目列表Simulate Promise.all
类型:online_judge
Implement a function similar to Promise.all that accepts multiple tasks (functions). The function should call a provided callback with the results of the tasks' execution once all tasks are completed. Assume the tasks are asynchronous and return Promise objects. Provide a complete implementation with test cases.
Example
Input
tasks = [lambda: example_task(i) for i in range(5)]
callback = lambda results: print("Results:", results)