In this problem i just understood that we have to arrange the array in non decreasing order

using powers of 2 please help me in understanding the problem.

The editorial is provided for this problem. Consider this testcase I took from the pool.

7

1 2 -8 -10 10 -9 6

There are other approaches too that maybe easy, I saw which pairs are already in increasing order, here use a for loop to iterate over the array. If you find any pair which is not increasing find their difference and keep the max difference among them, updating the previous value. This way you’ll find the maximum power to which 2 has to be. Hope this helps

1 2-move on

2 -8-differnce is abs 10

update -8 to 2

2 -10-differnce is abs 12

update -10 to 2

2 10-move on

10 -9-difference is abs 19

update -9 to 10

10 6-difference is abs 4

update 6 to 10

maximum difference is 19 so take log2(19)+1

Hope this helps!

My code-Submission #76685591 - Codeforces

Thanks it really helped