Loading...
Given n nodes, undirected edges, and two nodes source and destination, return True if a path exists between them.
Input: first line = n, second = edges as u:v comma-separated (or 'none'), third = source destination.
3 0:1,1:2,2:0 0 2
True
source node 0 to the destination node 2, as they are directly connected through node 1 and also through the cycle 0↔2.True because a path is found between the source and destination nodes.