Dsa
Graphs Bfs
Medium
Graph Path Counting
You are given a directed graph represented as a series of edges. Each edge is identified by a start node and an end node. You are also given a start node and an end node. Your task is to count the number of distinct paths from the start node to the end node. Return the count of paths. If there are no paths, return 0. The input starts with an integer n (total nodes), followed by m edges (each edge represented by start and end node). Example input: 4 4 0 1 1 2 0 2 2 3 | Output: 2
Key concepts
graphsbfscounting
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