Wolverine TradingOA #3
Shared Interest
估计中等评测数据准备中,可先阅读题面
考点(AI 标注)哈希计数
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 nodesint friends_from[friends_edges]: the first part of node pairsint friends_to[friends_edges]: the other part of node pairsint friends_weight[friends_edges]: the interests of node pairs Returnsint: maximal integer product of all node pairs sharing the most interests.
Constraints
A yet-to-be-unearthed secret