Comments

I got confused by the way I defined how the operation goes

the way I did it

is that ai = ai — 2* ai-1

the array increase more if the ai was negative, but the way the operation is defined makes that impossible. I had a brain fart!

Why is this test case of problem 2 a "NO" The array should act like this

[5, 6, 0, 2, 3, 0] to

[0, -4, -5, 2, 3, 0] to

[0, 0, 3, 6, 3, 0] to

[0, 0, 0, 0, 0, 0]

Making the answer YES because you can turn the whole array into Zeros.