Sale
Summer Offer: $190/yr $99/yr
00 : 00 : 00 : 00
Get this deal
Tech & SaaS Senior programming

LeetCode #1971 - Find if Path Exists in Graph

Given an undirected graph represented as an array of edges, write a function to check if there is a valid path between two nodes (the start and the end nodes).
Input:
edges = [[0,1],[1,2],[2,3],[3,4]]
startNode = 0
endNode = 4
Output:
true
Constraints:
1 <= edges.length <= 10^4
0 <= edges[i][0], edges[i][1] < 10^4
Suggested Answer

Trusted by 100+ professionals preparing for interviews

Trusted by 100+ professionals 50+ Company Question Banks 5+ Supported Languages

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

Get Started Free

More Tech & SaaS Interview Prep

LeetCode #123 - Best Time to Buy and Sell Stock III
Tech & SaaS · Senior
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Link copied to clipboard