Here is the interview question prompt, presented for reference.
Given a directed graph represented via an adjacency list, write a class StronglyConnectedComponents with a count() method that would return the number of strongly connected components in a graph.
The definition of a strong connected component is a subgraph of a directed graph where there's a path in both directions between any two pair of vertices. In other words, in the following graph:
You'll notice there's paths for every pair:
A to B
A to C
B to C (through A)
B to A
C to A (through B)
C to B
The StronglyConnectedComponents method you define should be able to return 1 if presented the above graph.
100000100000|V|, |E| represent the number of vertices and edges of the graphO(|V|*(|V|+|E|))O(|V|+|E|)You can see the full challenge with visuals at this link.
Challenges • Asked almost 6 years ago by Anonymous
This is the main discussion thread generated for How Many Strongly Connected.
Where the test cases at