Algorithm · ByteDance · Medium
A directed graph has n vertices labeled from 0 to n - 1. You are given the graph as an adjacency list graph, where graph[i] contains every vertex reachable by a single directed edge from vertex i. You are also given two distinct vertices source and target. Return every simple directed path from source to target. A path is represented as a list of vertices [v0, v1, ..., vk] such that: v0 == source vk == target for every consecutive pair, graph[vi] contains v_{i+1} no vertex…
Checking your access…