Back to problems

Find if a Path Exists in an Undirected Graph

Algorithm · ByteDance · Medium

Path Existence Easy · Topics · Company Tags · Hints You are given an undirected graph consisting of n vertices numbered from 0 to n - 1 and m edges. Decide whether there exists a path from a specified source vertex to a specified destination vertex. A path is a sequence of vertices where consecutive vertices are directly connected by an edge; you may traverse any number of intermediate vertices. If the source and destination are the same vertex, the answer is true by…

Checking your access…