what's wrong with the code-likecs03

solution link:https://www.codechef.com/viewsolution/15456629

I tried hard, seems perfect to me :expressionless:

Why a[0] = 1

Consider array
2 3 4 K = 3

I believe your code gives 0 while correct answer is 1.

Have a look at editorials i wrote… here

Hope that clarifies…