Easy
025Find if Path Exists in Graph
Given n, undirected edges, source, and destination, return true if a path exists.
EXAMPLES
Example 1
Input
{
"n": 3,
"edges": [
[
0,
1
],
[
1,
2
],
[
2,
0
]
],
"source": 0,
"destination": 2
}
Output
trueFUNCTION SHAPE
n: intedges: intMatrixsource: intdestination: int→bool