Search
⌘K

Leetcode 2359. Find Closest Node to Given Two Nodes

Given a directed functional graph (each node has at most one outgoing edge, possibly with cycles), find the node reachable from both node1 and node2 that minimizes the maximum of the two directed distances to it (return the smallest index on ties), or -1 if no such common reachable node exists.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.