⌘K
Flycodx

IRCTC Train Route Path Exists

IRCTC Train Route Path Exists

EasyGraphs100% accepted

IRCTC has n stations connected by bidirectional tracks. Given n nodes, a list of edges, source and destination, determine if a valid path exists between source and destination.

Approach

Check if a valid path exists between source and destination in an undirected graph.

Input

6 5 0 1 0 2 3 5 5 4 4 3 0 5

Output

true
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3