Can someone please answer the coding question below in C++ and leave comments explaining the code throughout. There is a tree (i.e., a connected, undirected graph that has no cycles) consisting of n nodes numbered from 0 to n – 1 and exactly n – 1 edges. Each node has a value associated with it, and the root of the tree is node 0.To represent this tree, you are given an integer array nums and a 2D array edges. Each nums[i] represents the ith node’s value, and each edges[j] = [uj, vj] represents an edge between nodes uj and vj in the tree.Two values x and y are coprime if gcd(x, y) == 1 where gcd(x, y) is the greatest common divisor of x and y.An ancestor of a node i is any other node on the shortest path from node i to the root. A node is not considered an ancestor of itself.Return an array ans of size n, where ans[i] is the closest ancestor to node i such that nums[i] and nums[ans[i]] are coprime, or -1 if there is no such ancestor. Example 1:Input: nums = [2,3,3,2], edges = [[0,1],[1,2],[1,3]] Output: [-1,0,0,1] Explanation: In the above figure, each node’s value is in parentheses. – Node 0 has no coprime ancestors. – Node 1 has only one ancestor, node 0. Their values are coprime (gcd(2,3) == 1). – Node 2 has two ancestors, nodes 1 and 0. Node 1’s value is not coprime (gcd(3,3) == 3), but node 0’s value is (gcd(2,3) == 1), so node 0 is the closest valid ancestor. – Node 3 has two ancestors, nodes 1 and 0. It is coprime with node 1 (gcd(3,2) == 1), so node 1 is its closest valid ancestor.Example 2:Input: nums = [5,6,10,2,3,6,15], edges = [[0,1],[0,2],[1,3],[1,4],[2,5],[2,6]] Output: [-1,0,-1,0,0,0,-1] Constraints:nums.length == n1 <= nums[i] <= 501 <= n <= 105edges.length == n – 1edges[j].length == 20 <= uj, vj < nuj != vjHere is starting class: class Solution {public:vector getCoprimes(vector& nums, vector<vector>& edges) { }};
![The University of Western Ontario Department of Computer Science London, Canada Software Tools and Systems Programming (Computer Science 2211A) LAB7 The week of October 22 - October 28, 2023 This lab is an exercise with pointer arithmetic. Question 2 of the lab exercise is taken from exercise 17 in Chapter 12 of our textbook: C Programming Language: A Modern Approach (Second Edition), by K. N. King. 1. Rewrite the following function to use pointer arithmetic instead of array subscripting. (In other words, eliminate the variables i and all of the [] operators.) Note that for any array a, the expression a[i] is equivalent to *(a+i). int sum_array(const int a[], int n) { int i, sum = 0; for (i = 0; i < n; i++) sum += a[i]; return sum; }](https://gotit-pro.com/wp-content/uploads/2023/10/c80fe157-523d-4b22-a16d-64c419fa011c-300x273.png)

Can someone please answer the coding question below in C and leave comments explaining the code
Original price was: $10.00.$5.00Current price is: $5.00.
-50%Download button will appear immediately after successful payment.
Full support will be provided with necessary files installation.
Get impeccable customized solution within 24 hours, hassle-free.
Erica Cupp –
Excellent job, my friend. Thank You!!
Nancy Del –
Follows the required notes. Right on time. Amazing solution.
Chris Brooks –
I am glad I got assistance, I’m am very happy with the service.
Frank Cory –
Thanks a lots, I really appreciate your effort it is an excellent report.
Megan Mowles –
Thank for your help and service. I really like the work that they did on my paper.