We are provided a set of numbers.
We can increment or decrement any given number by 1. This is denoted as a single operation. The objective is to make the GCD of the entire set of numbers equal to K. We need to find the minimum number of operations required.
In case the GCD was to be some multiple of K, it was easier. Just find the 2 multiples of K nearest to each number, but this doesn't always lead to GCD = K.
What can be the best approach to carry out this task?