dunjen_master's blog

By dunjen_master, history, 13 months ago, In English

You are given an array consisting of N elements. You can perform two operations any no. of times. 1. Make any even element E = E/2. and 2. Make any odd element E = 2E.

You have to minimize the maximum absolute difference between any two elements

For ex- N=2 {1,2}

We can make 2--> 2/2 = 1 Thus answer = 0

 
 
 
 
  • Vote: I like it
  • +12
  • Vote: I do not like it

»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

What constraints for N?

»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

for each N there are maximum log2(N)+1 number possible.insert it in a set and keep track of minimum and maximum

»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

At least wait for the contest to be over before asking the solution.

  • »
    »
    13 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I thought everybody would have different problems in their set. It was a 1.5 hour test which I have already submitted.

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone please explain the approach of this question