Largest strongly connected component
Your task
Given a directed graph with n nodes (0..n-1) and a list of directed edges [u, v], return the number of nodes in the largest strongly connected component. A single node with no edges is its own component of size 1. Constraints: 1 <= n <= 2000; self-loops and parallel edges may appear.
Examples
largest_scc_size(n: int, edges: list[list[int]]) -> intExample 1
Input
largest_scc_size(5, [[0, 1], [1, 2], [2, 0], [1, 3], [3, 4]])Output
3