--- id: 4 title: Synonyms topics: [graph] difficulty: medium --- ## Question ``` ''' Given a list of synonym pairs, determine if two words are synonymous. Synonyms have a symmetric and transitive relation. i.e. if a <-> b and b <-> c, a <-> c. Input: [["computer", "laptop"]] "computer" "laptop" Output: true Input: [["computer", "laptop"], ["laptop", "pc"]] "computer" "pc" Output: true Input: [["computer", "laptop"], ["laptop", "pc"], ["tablet", "iPad"]] "computer" "iPad" Output: false ''' ```