Checksum Aggregator
In a distributed network system, data packets with unique identifiers and checksum values are sent between nodes to maintain communication and data integrity. Develop a function to aggregate the checksum values for all possible pairs of packets within the network.
For any two distinct packets with identifiers i and j, the checksum is calculated as C(i, j) = i mod j + j mod i. Calculate the sum of C(i, j) for all pairs (1 <= i <= n) and (1 <= j <= n), where n is the total number of packets in the network. Return the result modulo (10 ** 9 + 7)
Function Description
Complete the function computeChecksumAggregation in the editor.
computeChecksumAggregation has the following parameter:
int n: the total number of packets in the network
Returns
int: the aggregated checksum
**My sincere thanks to da best friend for so generouly sharing the problem source! **
Example
Unlock to view complete problem details
and practice with sample input/output
View Test Cases & Run Code requires membership
