444iq's blog

By 444iq, history, 5 years ago, In English

You are given an array of N elements. You have to minimize the absolute difference between the max and minimum element. You can peform this operation any number of times. N can be upto 10^5. A[i] <= 10^9

The elements which are odd you can multiply it by 2. The elements which are even you can divide it by 2.

Eg.

arr[] = 1 2

divide 2 by 2. array becomes 1. Now minmum difference is 1-1 = 0. How to solve this problem.

  • Vote: I like it
  • -10
  • Vote: I do not like it