Replacing Element with n+2

why the -ve elements are replaced with n+2 and not with n+1

You have to ignore the negative numbers in this question.
So we replace it with a positive integer which is greater than all possible answers.
For an array of size n, the first missing positive number will always be in range [1,n+1]
So here we can replace negative numbers with any number >n+1.

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.