I did similar to this but instead of doing this one time i am doing this for several times,
Approach: find minimum of (arr[i]%n) (if arr[i]%n !=0) otherwise take minimum of arr[i] only then add (n-minimum obtained) in the answer and repeat this step until we get the (minimum found >=n).
Please Help! I am stuck here from 2 hrs !!