Algorithm · OpenAI · Easy
You are given a directed network in which every node has at most one outgoing edge. Implement the function: The arrays from_ids and to_ids have the same length and together list the edges, with each edge going from from_ids[i] to to_ids[i]. Begin at start_node_id and keep moving along the outgoing edge of the current node: When the current node has no outgoing edge, the answer is that node's ID. When the next move would land on a node that was already visited, the answer is…