Minimum content seed servers

Write codeMedium20 min

Your task

You operate a content-distribution network modeled as a directed acyclic graph of n servers (0..n-1); edge [a, b] means server a can push content to server b. You want to seed content into the fewest servers so that every server eventually receives it (directly or transitively). Return the minimum number of seed servers required. The graph is guaranteed acyclic; self-loops, if present, should be ignored.

Examples

min_seed_nodes(n: int, edges: list[list[int]]) -> int
Example 1
Inputmin_seed_nodes(4, [[0, 1], [0, 2], [2, 3]])
Output1