GoLang Solution For LeetCode Problem: Find Eventual Safe States
In a directed graph, we start at some node and every turn, walk along a directed edge of the graph. If we reach a node that is terminal (that is, it has no outgoing directed edges), we stop.
Which nodes are eventually safe? Return them as an array in sorted order.
Example: Input: graph = [[1,2],[2,3],,,,,] Output: [2,4,5,6] Here is a diagram of the above graph.
See the full details of the problem Find Eventual Safe States at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go