FastPrepMaximum K-Star Sum
Problems/Maximum K-Star Sum

Maximum K-Star Sum

Akuna Capital logoAkuna Capital● MediumOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Backed by a real source found on 07-20-2026. Match rate: approximately 96%.

You are given an undirected graph with g_nodes nodes and g_edges edges, together with an integer k. The nodes are numbered from 1 to g_nodes. Edge i connects g_from[i] and g_to[i].

A k-star is a non-empty subgraph that forms a star: one selected node is the center, and every other selected node is directly connected to that center. The star may have at most k arms.

Node i has value values[i - 1]. The sum of a k-star is the sum of the values of all nodes in the subgraph.

The illustration accompanying the example shows valid stars with 3 through 6 arms. The orange node is the center, every blue node is an arm, and every line is an edge.

A k-star does not need to have exactly k arms; k is only the upper limit. Find the maximum possible sum of a k-star.

Function

getMaximumSumKStar(g_nodes: int, g_from: int[], g_to: int[], values: int[], k: int) → int

Examples

Example 1

g_nodes = 5g_from = [3,3,3,3]g_to = [1,2,4,5]values = [10,20,30,40,50]k = 2return = 120
Example 1 illustration

The graph is a star centered on node 3. With k = 2, choose node 3 as the center and nodes 4 and 5 as its arms. Their values sum to 30 + 40 + 50 = 120, which is the maximum.

Constraints

  • 1 <= values.length = g_nodes.
  • g_from.length = g_to.length = g_edges.
  • Every edge joins two valid, distinct node numbers from 1 through g_nodes.
  • The graph is undirected and has no duplicate edges.
  • 0 <= k.

More Akuna Capital Online Assessment questions

  • Last Digit of the Ways to Split Traders Between Two OfficesOA · Seen Dec 2026
  • Light Bulbs Left On After All Engineers FinishOA · Seen Dec 2026
  • Delivery Management SystemOA · Seen Nov 2026
  • Count Server ReplacementsOA · Seen Nov 2026
  • Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Maximum Remaining Drone PowerOA · Seen Nov 2026
  • Rolling MetricsOA · Seen Oct 2026
  • Vowel Substring GameOA · Seen Sep 2026
  • Competitive ForagingOA · Seen Sep 2026
  • Binary CircuitOA · Seen Sep 2026

Similar questions at other companies

  • Divide Tree NodesGoogle · OA · ONSITE INTERVIEWGoogle interview questions
  • Hiking Club Fastest PaceInfosys · OAInfosys interview questions
  • Minimum Operations to Sort with Rotations Then SwapsBank of New York Mellon · OA
  • Find Minimum TimeAlphaSense · OA
  • Find Minimum TimeBlackRock · OABlackRock interview questions
  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
  • Minimum Cost K-Capable ModelsMicrosoft · OAMicrosoft interview questions
  • Minimum Cost of Every K-Capable Model SetTikTok · OATikTok interview questions
  • Maximum K-Star SumC3.ai · OAC3.ai interview questions
  • Maximum Distinct Values After Unit AdjustmentsBirla Pivot · OA

Interview reports that mention this question

  • Akuna Capital Quant Researcher Math OA Questions: 11 Experiences
  • Akuna Capital Quant Researcher CandiTech OA: 12 Experiences

Akuna Capital interview experiences

  • Akuna Capital Quant Trader and QR Interviews: 5 Experiences
  • Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
  • Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
  • Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
All Akuna Capital interview questionsSee Akuna Capital hiring insights
Saved
class Solution {
    public int getMaximumSumKStar(int g_nodes, int[] g_from, int[] g_to, int[] values, int k) {
      // write your code here
    }
}
Checking account…