Condensation Highways Problem
Condensation Highways Problem — ExecCode Hard DSA Practice
Solve the Condensation Highways 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
After shrinking each strongly connected component to a super-node, the remaining arcs between different components form a DAG. Count those unique super-edges (ignore multiples and ignore arcs inside a component). Return the number of distinct pairs (comp(u), comp(v)) with a directed edge u→v and different components. You are given: n — nodes edges — directed Return condensation DAG edge count. A single SCC has 0 condensation edges.
Examples
Input {'n': 3, 'edges': [[0, 1], [1, 0], [1, 2]]}; Output 1. Input {'n': 2, 'edges': [[0, 1], [1, 0]]}; Output 0. Input {'n': 2, 'edges': [[0, 1], [0, 1]]}; Output 1
Constraints
Parallel original edges between the same two components count once
Practice Condensation Highways free on ExecCode. Browse DSA problems, topic map, and placement guides.