Can you tell me where i am going wrong?

https://www.codepile.net/pile/2w80aQwo

Hi @premang , there are some small mistakes in your code viz:-

  1. at line 21, instead of int case2_ans=cum_sum+(-cir_kadane); it should be int case2_ans=cum_sum+cir_kadane; you should not subtract cir_kadane as cir_kadane will be <=0 and subtractive a non positive number will increase the sum making it even more than cumm_sum which is not possible
  2. at line 39 , it should be if only instead of else if as there are some cases when both will be mutually true

Here, I have corrected your code :-