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]) 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. Notes: 1-based indexing is followed. A connected component of an undirected graph is an induced subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the rest of the 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 Note: Use this input format if you are testing against cus