600
1 Like

DSA Crash Course [Part 57] - Connected Components Count Approach

In this lesson, Alvin explores the strategy to solving the following interview problem:

Write a function, connected_components_count, that takes in the adjacency list of an undirected graph. The function should return the number of connected components within the graph.

connected_components_count({
  0: [8, 1, 5],
  1: [0],
  5: [0, 8],
  8: [0, 5],
  2: [3, 4],
  3: [2, 4],
  4: [3, 2]