determineMaxDataFlow

Company: Amazon_3oct

Difficulty: medium

Problem Statement

determineMaxDataFlow Problem Description As an engineer in Amazon's Data Infrastructure Team, you are optimizing how information flows through a network of processing nodes. There are n processing nodes, numbered 1 to n , and the bandwidth capability of node i is bandwidth[i] . There are streamCount data channels. Each data channel must be connected to two processing nodes: one as its main connection and one as its secondary connection. The dataFlow of a channel is the sum of the bandwidths of its main node and its secondary node. Each data channel must use a unique pair of nodes: A pair (x, y) means node x is the main connection and node y is the secondary connection. The pairs (x, y) and (y, x) are different connections, so both may be used by two different channels. The same node may be both the main and the secondary connection, so (x, x) is a valid pair. No two channels may select the same pair (x, y) . So there are exactly n * n pairs to choose from, and every channel picks a dif