Search
⌘K

Leetcode 1857. Largest Color Value in a Directed Graph

Given a directed graph where each node has a lowercase color, find the maximum number of occurrences of any single color along any valid path, or return -1 if the graph contains a cycle. The core challenge is cycle detection plus aggregating color frequencies across the DAG (typically solved with topological order or DFS + DP to propagate 26-color counts).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.