Algorithm · C3.ai · Medium
You are given a simple undirected graph G containing g_nodes nodes and g_edges edges. The nodes are labeled 0 through g_nodes - 1, and node i carries the value values[i]. The edges are described by the arrays g_from and g_to, where the i-th edge joins g_from[i] and g_to[i]. A k-star is a non-empty subgraph built by picking one node as the center and then selecting no more than k of that center's neighbors as its arms. Selecting no arms at all is permitted, so any single node…