You are given an array a of integer of size N.
Now, select any two adjacent indices,
ifa[i] == a[i+1], then remove both a[i] && a[i+1] and put add a[i]+1 in the same array
Print the maximum of the number left.
if a = [4, 3,3, 4, 4,4]
4,4,4,4 first step
5,4,4 second step
5,5 third step
6 fourth step
6 is the answer
Help me in coding this
> if a = [4, 3,3, 4, 4,4]
> 4,4,4,4 first step
Why isn't it [4,4,4,4,4] after the first step?
You replace 3,3 with 4.
After a replacement, do you start at the beginning of the array again, or carry on from the new a[i] just calculated?