Largest connected component
Your task
Given an undirected graph with n nodes (0..n-1) and an edge list, return the size of the largest connected component (the number of nodes in it). The graph may be disconnected and may contain isolated nodes. If n is 0, return 0. Duplicate edges may appear.
Examples
largest_component_size(n: int, edges: list[list[int]]) -> intExample 1
Input
largest_component_size(6, [[0, 1], [1, 2], [3, 4]])Output
3