I dont know why I am getting compilation error.
Compilation Error
I resolved the compilation error but it is givng garbage values like this 140005594344064 140005594344064
This is my code
intialise ans with 0
also in line 24 , make it i<n
I did it now I am getting answer as 0 also I feel it should be n+1 because B has n+1 elements
a) u are only reading n-1 elements becuase the first for loop u are running from 1…n-1
b) intilaise B[0] with 1 , empty subarray
c) why A[0]=0 ? It should contain first value of given array
Sir I am trying to form the cumulative sum array at the time of taking input itself
Should I first take input and then form cumulative sum array?
yeah that will be better.
check this
Thanks Sir it worked
Arr[0]=1 because null subarray amounts to 0?
…
yeah correct
…
…