872. Leaf-Similar Trees

872. Leaf-Similar Trees Given a directed acyclic graph, with n vertices numbered from 0 to n-1, and an array edges where edges[i] = [fromi, toi] represents a directed edge from node fromi to node toi. Find the smallest set of vertices from which all nodes in the graph are reachable. It’s guaranteed that a unique solution exists. Notice that you can return the vertices in any order. 1 2 3 4 5 Example 1: Input: n = 6, edges = [[0,1],[0,2],[2,5],[3,4],[4,2]] Output: [0,3] Explanation: It's not possible to reach all the nodes from a single vertex....

<span title='2021-04-03 00:00:00 +0000 UTC'>April 3, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx