NeetCode #620LC-1857HardGraphs
← Back to All Problems

#620 · #1857 · Largest Color Value in a Directed Graph(有向图中最大颜色值)

📌 Problem Statement & Constraints

You are given a directed graph of n coloured nodes (colors[i] is a lowercase letter) and edges. A valid path follows the edge directions. The path's colour value is the maximum count of any single colour along it. Return the maximum colour value over all valid paths, or -1 if the graph contains a cycle. Constraints: 1 <= n <= 10^5, 0 <= edges.length <= 10^5, colors.length == n.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!