Back to course home
0% completed
Problem 1: Find if Path Exists in Graph(easy)
Problem Statement
Given an undirected graph, represented as a list of edges. Each edge is illustrated as a pair of integers [u, v]
, signifying that there's a mutual connection between node u
and node v
.
Given this graph, a starting node start
, and a destination node end
, your task is to ascertain if a path exists between the starting node and the destination node.
Examples
- Example 1:
- Input:
4, [[0,1],[1,2],[2,3]], 0, 3
- Expected Output:
true
- Justification: There's a path from node 0 -> 1 -> 2 -> 3.
- Input:
- Example 2:
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!