You are given an undirected graph with n nodes labeled from n, and an array edges where each edges[i] = [u_i, v_i] represents an undirected edge between node u_i and node v_i. The graph may contain multiple edges connecting the same pair of nodes.
You are also given an integer array queries. The answer for query queries[j] is the total number of pairs of nodes n such that the number of edges incident to node queries[j].
An edge is incident to node
Return an array answers where answers[j] is the answer for queries[j].
Note: An edge directly connecting node
and node is counted only once when determining the total number of incident edges for the pair .
Constraints:
n
edges.length
u_i, v_i n
u_i v_i
queries.length
queries[j] edges.length
You are given an undirected graph with n nodes labeled from n, and an array edges where each edges[i] = [u_i, v_i] represents an undirected edge between node u_i and node v_i. The graph may contain multiple edges connecting the same pair of nodes.
You are also given an integer array queries. The answer for query queries[j] is the total number of pairs of nodes n such that the number of edges incident to node queries[j].
An edge is incident to node
Return an array answers where answers[j] is the answer for queries[j].
Note: An edge directly connecting node
and node is counted only once when determining the total number of incident edges for the pair .
Constraints:
n
edges.length
u_i, v_i n
u_i v_i
queries.length
queries[j] edges.length