I cant understand this problem

bhaiya told earlier that (a-b)%m=(a%m-b%m+m)%m,
but here bhaiya did (b-a)%m=0 to a%m=b%m howw??

what negative numbers? cant understand ? negative number referring to a-b being negative?

@Ishitagambhir,
That’s not true,

(9-6) % 4 = 3 = ((9%4)-(6%4)+4)%4 != ((9%4)-(6%4))%4

@Ishitagambhir ???

hi @namanmittal0007
( a – b) % c = ( ( a % c ) – ( b % c ) ) % c this is the distributive property of modulo

a%m-b%m+m here m has been added to ensure that if a%m-b%m is negative, it will become positive. So there is no need to add m if that value comes out to be positive. You can verify this by taking any example.

okay another doubt in the same video 1,2,3,4,5 in this 5th element 5 itself cam be considered as a subarray ?

@namanmittal0007 a subarray of size 1 is also to be considered a subarray only, so yes 5 itself can also be considered.

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.