Algorithm · Amazon · Medium
Create a program that returns every path beginning at a specified vertex in a directed graph. Input: A node count n; nodes are labeled from 0 through n-1. An edge collection in which each pair u, v denotes a directed edge from u to v. A source node named start. Output: Return all paths that originate at the specified node, with each path expressed as a list of node labels. Example: Input: n = 5, edges = [[0,1],[0,3],[1,4],[3,4]], start = 0 Output: [[0,1,4],[0,3,4]] The…
Checking your access…