Given an integer n representing tasks labeled 0..n-1 and a list of prerequisite pairs (a, b) meaning b must be completed before a, return any valid ordering of tasks that completes all tasks, or an empty list if no ordering exists. Design an efficient algorithm and data structures, explain how you detect cycles, and analyze time and space complexity. Follow-ups: (