if sum=-5 noue a[i]=3
sum+=a[i] will ne -2
sum=sum%n will be [-5+3]%5 i.e -2
sum=(sum+n)%n will be (-2+5)%5 i.e 3 how ? confused
Cant understand from 14:20
Sum can never reach -5 if n is 3. Also this is just basic modulo operation.
Read this article for more insight https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-1/tutorial/
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.