Search
⌘K

Leetcode 3607. Power Grid Maintenance

Given an undirected graph of c stations whose connectivity is fixed, process queries that either mark a station offline or ask which operational station with the smallest id resolves a maintenance check for station x (if x is online it answers itself, otherwise return the smallest-id online station in x's connected component or -1 if none). The core challenge is to precompute components and support dynamic deletions while keeping track of the minimum alive id in each component for fast query answers.


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.