InterviewDB Question

Maximum Subgraph: Find the Largest Connected Subgraph Satisfying a Node Constraint

Question Details

Problem Given an undirected graph where each node has a label, find the largest connected subgraph where all nodes share the same label. "Largest" means the most nodes. Example: Follow-ups How does your BFS/DFS handle disconnected graphs (multiple components)? What is the time and space complexity of your solution? How would you extend this to find the largest subgraph where nodes satisfy a predicate (e.g., label in {A, B})? If edges are weighted, how would you find the subgraph with the maximum…

Full Details

🔒

Unlock all Waymo questions

Full insider details, leaked discussions, and candidate experiences.

or every company, $100/year →

About This Question

This is a reported interview question from a waymo interview during the phone round.

It covers the following topics: Coding, Phone, Graph .