Company: HiLabs_SDE
Difficulty: medium
Connected components Problem Description Given an undirected graph consisting of N nodes. There is a number written on each node which is given in the form of an array a of N distinct integers, where a[i] represents the number written on the i th node. There is an edge between the node i and j if lcm(a[i], a[j]) <= 10 6 . Where LCM of two numbers is the smallest positive integer which is divisible by both of them. Print the number of connected components in this graph. Function Description Complete the function solve . This function takes the following 2 parameters and returns the required answer: N : Represents the size of array arr arr : Represents the elements of array arr Input Format for Custom Testing Note: Use this input format if you are testing against custom input, writing code in a language where we don't provide boilerplate code. The first line contains a single integer N . The second line contains N space-separated integers, the i th of which is a[i] . Notes 1-based ind