why is (b-a)%n=0, is b%n=a%n
Divisible subarrays problem
the array is divisible when sum_of_subarray%n==0, now sum_of_subarray when prefix sum are maintained is pre[i]-pre[j-1] for subarray [j,i].
then
yes this is true.
1 Like
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.
Why is (b-a)%n=0, is b%n=a%n?
Yes , take this example —> (17-2)%5=0 as 17%5=2%5=2.