Question bank › Graphs Dfs
Dsa Graphs Dfs Easy

The Firewalled Network

In a corporate network of N servers (0 to N-1), you need to check if a signal can travel from a source server S to a destination server D. However, some servers are 'Firewalled' and will not pass any signals through them. Input: The first line contains N and M (edges). The next M lines contain edge pairs u v (bidirectional). The next line contains K (number of firewalled servers), followed by K space-separated server IDs. The last line contains S and D. Output: 'YES' if a path exists avoiding firewalled servers, otherwise 'NO'. Example: Input: 4 3 0 1 1 2 2 3 1 2 0 3 Output: NO

Key concepts

graphs_dfsreachability

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.