Leetcode 1501. Countries You Can Safely Invest In
Given a directed graph of investment edges between countries, identify all countries from which every path eventually terminates and never reaches a cycle (i.e., "safe" nodes). This is a cycle-detection / graph-traversal problem — find nodes not in or that can't reach cycles using DFS three-color marking, reverse-topological pruning, or SCC decomposition.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.