Skip to main content
Technical

Given a graph with N nodes and M edges, identify its network topology. Return 1 for Bus (linear chain), 2 for Star (one central node), 3 for Ring (circular), or -1 if none match.

Top community answer

No community answers yet.

Contribute an answer

Have a better answer?

Share your experience and earn credits toward your next interview session.

Contribute an answer