Rumor Strong Components Problem
Rumor Strong Components Problem — ExecCode Hard DSA Practice
Solve the Rumor Strong Components problem on ExecCode. Free online hard DSA practice in Graph. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Directed rumor links: if A points to B, a rumor at A eventually reaches B. People who can all reach each other sit in one strongly connected component. Tarjan (or Kosaraju) counts those components. Directed edges [u, v]. Return the number of SCCs. Isolated nodes each form their own component. You are given: n — people edges — directed rumor links Return component count. A cycle of 3 is one SCC.
Examples
Input {'n': 3, 'edges': [[0, 1], [1, 2], [2, 0]]}; Output 1. Input {'n': 3, 'edges': [[0, 1]]}; Output 3. Input {'n': 1, 'edges': []}; Output 1
Constraints
Self-loops do not merge extra nodes n counts isolated vertices too
Practice Rumor Strong Components free on ExecCode. Browse DSA problems, topic map, and placement guides.