since we know that
(a-b)%N = (a%N - b%N +N)%N
but bhaiya ignored +N term part at 5:10 Why??
CPP - Divisble Subarrays, Pigeonhole Problem
Hey it was just missed in the explaination part. We never used (a-b)%N = (a%N - b%N)%N in the code. Infact we didn’t even need the term (a-b) % n as we made an array counting a%n == b%n terms. And then use pnc to find number of subarrays. So missing +N in explaination is not that big of a issue. I hope this clears your doubt .
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.