cswork / OAOpen practice workspace

Wolverine TradingOA #3

Shared Interest

Estimated MediumStatement and editorial — judging is being prepared

Topics (AI-labelled)Hashing

Given a graph of friends who have different interests, determine which groups of friends have the most interests in common. Then use a little math to determine a value to return. The graph will be represented as a series of nodes numbered consecutively from 1 to friends_nodes. Friendships have evolved based on interests which will be represented as weights in the graph. Any members who share the same interest are said to be connected by that interest. Once the node pairs with the maximum number of shared interests are determined, multiply the friends_nodes of the resulting node pairs and return the maximal product. Function Description Complete the function maxShared in the editor. maxShared has the following parameter(s):

  • int friends_nodes: number of nodes
  • int friends_from[friends_edges]: the first part of node pairs
  • int friends_to[friends_edges]: the other part of node pairs
  • int friends_weight[friends_edges]: the interests of node pairs Returns int: maximal integer product of all node pairs sharing the most interests.

Constraints

A yet-to-be-unearthed secret

Editorial

Loading solution…