Why do we take array size as 100005 most of the time?
100005's significance
@tomarvikas738 it is all depend on problem size what type of constraints associate with it for example if input constraint is like 10^5 so you have to declare array of size 100005 and it also help in corner cases
There is no fixed rule to take the size of array as 100005…we generally take the size of the array as the constraints plus 5. we add the extra 5 so that if at any point i exceeds the the maximum value of the constraints in the last iteration of loop, and tries to access a[100001] (for ex.), the program doesn’t give runtime error.
1 Like