I don’t get where the principle is actually taken into consideration.The whole explaination for me seems to revolve around the fact that b%n=a%n
How did the pigeonhole principle help in this case
hey @sushant19_99, pigeon hole principle says that if you have n pigeons and n-1 holes then atleast 2 pigeon will have same hole similarly in this problem when you make prefix sum array it will have size n+1 but since you are taking %n for the prefix sum so you can fill that array with atmost n values means one box of your prefix sum array have to be shared by one of the values from 0 to n-1 (means atleast 1 value will be common in atleast 2 boxes). then you can proceed with the logic told in the solution
hey @sushant19_99 did your doubt get cleared or if you still have any doubt please ask else mark this doubt as resolved,Thankyou.
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.