InterviewDB Experience

Find Synonyms: Return All Words Reachable via Synonym Chains

Interview Experience

Round 1 - Coding Problem You have a list of synonym pairs. Given a query word, return all words reachable from it through any chain of synonyms. Synonyms are bidirectional. Example Approach Model as an undirected graph (Union-Find or BFS/DFS). Each word is a node; each pair is an edge. Return the connected component of query, excluding query itself. Follow-ups How does your runtime change if pairs are added dynamically after the initial build? How would Union-Find help? Suppose synonyms have wei…

Full Details

🔒

Unlock all Glean questions

Full insider details, leaked discussions, and candidate experiences.

Get full access — $100 a year, unlimited access

About This Question

This is a candidate experience report from a glean interview during the phone round.

It covers the following topics: Phone, Graph, Coding, Union Find, Onsite .