Challenge: Check If a Path Exists between Two Vertices
Try to solve the Check If a Path Exists between Two Vertices problem.
We'll cover the following
Statement
Given a 2D list, edges
, representing a bidirectional graph, where each vertex is labeled from
Determine whether a valid path exists from the source
vertex to the destination
vertex. If it exists, return TRUE, otherwise return FALSE.
Constraints:
n
edges.length
edges[i].length
source
,destination
There are no duplicate edges
There are no self-edges
Examples
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.