NeetCode #648LC-1579HardAdvanced Graphs
← Back to All Problems#648 · #1579 · Remove Max Number of Edges to Keep Graph Fully Traversable(保证图可完全遍历)
📌 Problem Statement & Constraints
Alice and Bob share an undirected graph of
n nodes. edges[i] = [type, u, v]: type 1 is Alice-only, type 2 is Bob-only, type 3 is both. Return the maximum number of edges that can be removed while keeping the graph fully traversable for both, or -1. Constraints: 1 <= n <= 10^5, 1 <= edges.length <= min(10^5, 3 * n * (n - 1) / 2).🔒
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!