Leetcode 1627. Graph Connectivity With Threshold
Given n and a threshold, determine for each query whether two nodes in 1..n are connected in the graph where an edge exists between x and y iff gcd(x,y) > threshold. The core challenge is efficiently answering connectivity queries by grouping numbers that share any divisor > threshold (typically done with a union-find/DSU over multiples of each divisor).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.