Path Existence Queries in a Graph I

Solution Code
Verifying access...

Time Complexity

O(N + Q)

Space Complexity

O(N)