How do we know what sized array should we take according to the constraint?
Why did we make an array ofsize 100005?
Hey @Sauravlama it is given in the question that N goes upto 10^5, so we take an array of size of 10^5 + 5 so that maximum number of elements can accumulate in that array and we usually take few elements more than the maximum number of the elements to access elements like n, or n+1 if need be.
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.