I have seen a problem like :
given an array of length n, there is an edge between two elements a[i] and a[j]
if lcm(a[i], a[j]) >= some number
, or gcd(a[i], a[j]) != 1
. Find the number of ways to reach this or something like this. `
Help me find such problems. If there is any tip like how to approach these problems, because I can't store the adjacency list from the array because it would be n * n.
Try this: https://leetcode.com/problems/count-connected-components-in-lcm-graph/description/