Leetcode: Find Closest Node to Given Two Nodes
A graph problem
You are given a directed graph of
n nodes numbered from
n - 1, where each node has at most one outgoing edge.
The graph is represented with a given 0-indexed array
edges of size
n, indicating that there is a directed edge from node
i to node
edges[i]. If there is no outgoing edge from
edges[i] == -1.
You are also given two integers
Return the index of the node that can be reached from both
node2, such that the…