Company: Nokia_9march
Difficulty: medium
Product of pairs Problem Description Given an array A consisting of N elements and an integer K. Let's define a function as follows: f(i,j) = { A_i x A_j if i < j and K | (j-i) { 0 else Note: K|(j-i) denotes (j-i) is divisible by K. Calculate ∑ i=1 N ∑ j=i+1 N f(i,j). Function Description Complete the solve() function. This function takes the following 3 parameters and returns the answer: N : Represents the size of the array K : Represents the number K according to the problem statement A : Represents an array of integers of size N Note: 1-based indexing is followed. Input Format Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code The first line contains T, which represents the number of test cases. For each test case: The first line contains an integer N denoting the size of the array The second line contains an integer K The third line contains N space-separated integers denoting the arra