why we make p[0]=1 as in explanation part prateek bhaiya wont do anything like that plaese explain me the logic behind p[0] to be declare as 1
Prefix array starting understanding
yes I have doubt in divisible subarray problem
hey @TheSourabh as in the array we are finding the sum and incrementing at the index of that sum also .
that why in the begining we have incremented for sum=0 that’s why he has incremented in the array when sum =0.
pre[0] means when sum is 0 increment at that index so we have pre declared it as 1.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.