Why int result get initialise with INT_MIN

Greetings to the team,
I want to know why this step has been done

  1. int result= INT_MIN;
    why can’t we directly take result as INT_MAX?

hi @Tanvi-Varshney-250726472940778
if you take it a variable result = INT_MIN
and calculate an ans .
and update the result like result = max(result, ans)
then the result will be updated with the answer you calculated

But if you initialise result = INT_MAX
and calculate ans
and update the result like result = max(result, ans)
result will NOT get updates, because INT_MAX will always be greater than anything you put in ans variable

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.