Divisible subarrays problem

In this question , why bhaiya is doing pre[0]=1 initially, i’m not able to understand this concept.

https://ide.codingblocks.com/s/334227 , one of my test case is not passing, please check/

Can you send me the link of where you are submitting?

Also pre[0] is 1 because it allows us to use same formula for 0. Basically 0 can be unique.

and bhaiya, ye smjh ni aaya why pre[0]=1, initially we are taking.

Because for every other number you need atleast two of those, but even one occurrence of 0 is also enough , so that’s why.

You are printing unnecessary things in line 32

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.