Company: Edelwiess_14nov
Difficulty: medium
Question 2 Problem Description In this challenge, construct a rooted undirected graph and then answer some queries on the graph. There are n nodes numbered from 1 to n. All the nodes are disconnected initially. Construct the graph by drawing an undirected edge between n pairs of nodes, picking one pair at a time and connecting the first and second nodes. After connecting each of the pairs, the graph construction is complete, and node 1 is the root node of this graph. The graph is considered a tree rooted at node 1, and subtrees can be formed at any node and consisting of its descendants. Each node has a positive integer value associated with it. Find the total number of nodes with prime numbers as prime numbers in a given subtree rooted at a given node. Note that 1 is not a prime number. There are multiple queries. Sample Tree Construction Function Description Complete the function primeQuery in the editor below. The function must return an array of integers, each the result of a query