Блог пользователя 444iq

Автор 444iq, история, 5 лет назад, По-английски

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.

  • Проголосовать: нравится
  • -10
  • Проголосовать: не нравится