Longest Directed Path
Given a list of directed edges representing relationships between nodes, find the length of the longest directed path in the graph. A directed path is a sequence of nodes where each consecutive pair is connected by a directed edge.
Asked at:
Oscar Health
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late June, 2026
Oscar Health
Senior
Given a list of directed edges representing relationships between nodes, find the length of the longest directed path. A directed path is a sequence of nodes where each consecutive pair is connected by a directed edge. Example: Input: [(A, B), (A, D), (D, E)] Graph: A → B │ └→ D → E Longest paths: A → D → E Output: 3 Explanation: The longest directed path contains 3 nodes.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.