Given N(total nodes) and two arrays consisting the edges, for each acyclic graph, add nodes in graph, calculate the square root and add all square roots.
Asked in the HackerRank OA stage. Treat nodes as labeled 1 through N; edge_u[i] and edge_v[i] form one undirected edge. The edges form a forest. Return the sum of the square roots of the node-label totals for all connected components.
Implement sum_component_square_roots(n, edge_u, edge_v). Return a floating-point value. Nodes with no incident edge form single-node components.
def sum_component_square_roots(n, edge_u, edge_v):