NeetCode #574LC-802MediumGraphs
← Back to All Problems#574 · #802 · Find Eventual Safe States(找到最终的安全状态)
📌 Problem Statement & Constraints
There is a directed graph of
n nodes where graph[i] lists the nodes reachable from i. A node is safe if every possible path starting there eventually reaches a terminal node (a node with no outgoing edges). Return all safe nodes in ascending order. Constraints: 1 <= n <= 10^4, 0 <= graph[i].length <= n.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!