Question bank › Graphs Bfs
Dsa Graphs Bfs Hard

City Connection Paths

You are tasked with finding the total number of distinct paths between two cities in a map represented as a directed graph. You need to count the ways to travel from a starting city S to a destination city D without revisiting any city. Input Format: The first line contains an integer N, the number of roads. The next N lines contain two integers A and B, representing a directed road from A to B. The last line contains the integers S and D. Output Format: Print the number of distinct paths from S to D. Example: Input: 4 1 2 1 3 3 2 2 4 1 4 Output: 2

Key concepts

graphsbfsexploration

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.