152. Leads to Destination

Given a directed graph with n vertices (0..n-1), an array of edges edges, and source and destination. Return true if every path from source leads to destination (no dead ends or cycles that divert from the destination).
Example 1
Input: n = 3, edges = [[0,1],[0,2]], source = 0, destination = 2
Output: false
Explanation: There is a path to dead end 1.
Example 2
Input: n = 4, edges = [[0,1],[0,2],[1,3],[2,3]], source = 0, destination = 3
Output: true
Explanation: All paths from 0 lead to 3.
graph
JavaScript
Loading...
Line 1, Char 1