Find Cut Vertices

Given an undirected graph, find out all the vertices when removed will make the graph disconnected.  Initially the graph is connected.

For example given the graph below:

Return [2, 3]. Because we can make the graph disconnected by removing either vertex 2 or vertex 3.

Input:

nodeNum, the total count of vertices in the graph. Each vertex has an unique id in the range from 0 to nodeNum - 1 inclusive.

edges, a list of integer pairs representing all the edges on the graph.

output:

A list of integers representing the ids of the articulation points.

example:

Input:

nodeNum = 7

edges = [[0,1], [0, 2], [1, 3], [2, 3], [2, 5], [5, 6], [3,4]]

Output:

[2,3,5]


Solve the problem:
Python3
def findCutVertices(nodeNum, edges):





Get one-to-one training from Google Facebook engineers

Top-notch Professionals

Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.

Customized Private Class

Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.