You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges, where each edges[i] = [ui, vi] denotes a bi-directional edge between vertex u_i and vertex v_i. Every vertex pair is connected by at most one edge, and no vertex has an edge to itself.
You want to determine if there is a valid path that exists from vertex source to vertex destination.
Given edges and the integers n, source, and destination, return true if there is a valid path from source to destination, or false otherwise.
There is a bi-directional graph with
n
vertices, where each vertex is labeled from0
ton - 1
(inclusive). The edges in the graph are represented as a 2D integer array edges, where eachedges[i] = [ui, vi]
denotes a bi-directional edge between vertexu_i
and vertexv_i
. Every vertex pair is connected by at most one edge, and no vertex has an edge to itself.You want to determine if there is a valid path that exists from vertex
source
to vertexdestination
.Given
edges
and the integersn
,source
, anddestination
, returntrue
if there is a valid path fromsource
todestination
, orfalse
otherwise.Example 1:
- 0 → 1 → 2
- 0 → 2
Example 2:
Constraints:
The text was updated successfully, but these errors were encountered: