Articulation points

Write codeHard40 min

Your task

Given an undirected graph of n nodes (labeled 0..n-1) and a list of edges, return all articulation points (cut vertices): nodes whose removal increases the number of connected components. The graph may be disconnected. Return the node labels in ascending order.

Examples

articulation_points(n: int, edges: list[list[int]]) -> list[int]
Example 1
Inputarticulation_points(5, [[0, 1], [1, 2], [2, 0], [1, 3], [3, 4]])
Output[1, 3]