• + 1 comment

    I don't understand the answer to the first query for the sample input; the value (number of coprime edges in the path from node 4 to node 6) is shown as 9, but I don't see how it can be any value greater than 5. Here's my thinking: 1. It says the graph is undirected, connected, with nEdges = nNodes - 1. 2. This means the graph is a tree (acyclic) so there is a unique path between nodes. 3. The maximum length of a shortest path between two nodes can't exceed the number of edges, which is 5. What's going on?