K deletion cypher august19

problem: CodeChef: Practical coding for everyone

https://www.codechef.com/viewsolution/26093462
what’s wrong in this code?getting wrong answer when i submit.

Frankly speaking. I did not even understand the Question.

Hope it will helpful
https://www.codechef.com/viewsolution/26094183
I have calculated the sum for first K elements and save the first and last element
from each iteration from 1 to N-K , I am removing first element and adding A[last+1] element and comparing with previous ans. So, in O(N) time.

1 Like

I calculated the sum of all elements and then I find the minimum sum of K continuous elements. Then the answer will be Sum minus minimum sum.

My solution : CodeChef: Practical coding for everyone

I’have also tried the same logic.But i am getting the error.maybe i have some problem in the code where i am finding the min sum of k elements.