Extra Space because of INT_MAX and INT_MIN?

If instead of using INT_MAX or INT_MIN(which I suppose take up comparatively more space…Do they?), we can also initialize smallest and largest with first number of array and then go on comparing from there…Will it reduce the size or does it not matter?

Hi @RishabhK

we want to initialize with the value that can be easily replaced by a value in the array.
so for max, we initialize it with INT_MIN so that any number in the array will be greater than INT_MIN and hence it will easily be replaced.

same logic for INT_MAX

In terms of space, it doesn’t even matter whether you take it as INT_MIN or first element directly.

Hope your doubt is resolved.