Comments

In Problem D why the answer is -1 when we have both negative and positive in our array after applying the operation (a[i] = a[i] — k) ?

How is the time complexity of problem D is O(nlog(n))?

+1

Mine too

Is above piece of code works for both odd and even length palindromes or we have to do something more for even length palindromes ??

In your solution you have considered both index and prevstate as your states so TC will be index*prevstate that is why it is giving tle.

check for 1 4 0 0 0 0

Consider a case where all the elements of array are zero.

On Guwanch1C++, Python or Java, 4 years ago
+2

go for c++