Help with approach

prob: https://codeforces.com/contest/1490/problem/A

approach from editorial:

while a[i] * 2 < a[i + 1]:
a[i] *= 2
ans += 1

why are we multiplying by 2 we could also get some answer by adding 1 to the current element, please explain how the author came to this conclusion

hello @raghav007

we need to insert minimum number of elements right?

a[i] …a[i+1] we need to insert some element such that the sated property always holds.
now if a[i] < 2a[i+1]
it means we need to insert some elements in between
so we insert 2
a[i] in place of a[i]+1 becuase that will cover maximum range in less elements
a[i] , 2a[i] , a[i+1] again check same codition on 2a[i] and a[i+1] and repeat till above condition holds

Is it efficient for me to try to solve such kind of problems and learn from the editorials, by efficient I mean that are the techniques which I learn from one problem transferable to other problems as well? or would I be better of solving easier problem sets from other sites like cses.

@raghav007
for learning classic algorithms u should definetely try cses problemset.

for practice keep praticiapting in contests and uplsove.