 All Problems
Find if Path Exists in Graph
easy
graphs
bfs
dfs
union find
amazon
google
facebook

There is a bi-directional graph with n vertices (0-indexed). Given an integer n, a list of edges, source, and destination, return true if there is a valid path from source to destination.

Example 1:

Input:
6 4
0 1
0 2
3 5
5 4
Source: 0 Dest: 5
Output: false

Input format: Line 1: n edges. Next edges lines: u v. Last line: source dest.

Output format: true or false.

Run to check your code against the sample cases, or submit to run every case