Given is an array of size 2*N, we have to do N operations on that array, each array operation includes removal of ANY 2 array elements, the score of each operation is equal to the GCD of the two chosen numbers multiplied by the operation number. We have to maximise this score.
For example N = 2, arr = {3, 4, 9, 5}
1)We choose 4 and 5, GCD(4,5) = 1; Operation Number = 1 => score = GCD(4, 5)*1 = 1
2)We choose 3 and 9, GCD(3, 9) = 3; Operation number = 2 => Score = GCD(3,9)*2 = 6
Total Score = 7
constraints:
i) 1 <= N <= 10
ii) 1 <= array elements <= 1e9