Divisible subarray problem

why there is an extra element in cumulative sum array
?

this is require to apply pigeonhole principle
so that there are n holes and n+1 pigeon

after adding one extra element
we have n+1 element but distinct values that can be occured are n only form(0 ot n-1)
this is because we are taking mod with n

so we have n+1 pigeon(size of array ) and n holes( distinct values)

in this way pigeonhole principle is applied here

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like :heart:: and don’t forgot to mark doubt as resolved :grinning: