//The number cannot be something greater than nums.length + 2 - (no. of -ve and zeroes)

//Why this is true?

//because even if all the numbers are >0 an array of size x can hold x elements at maximum.

//If all the elements from 1 to x are present then x+1 must be the missing element. Any number >=2 cannot be a candidate.

//Therefore, we can safely take the size of the tracker array to be nums.length + 1

public class Solution {

public int firstMissingPositive(int[] nums){

```
boolean[] tracker = new boolean[nums.length+1];
for(int i=0;i<nums.length;i++){
if(nums[i]>0 && nums[i]<=nums.length+1){
tracker[nums[i]-1] = true;
}
}
for(int i=0;i<tracker.length;i++){
if(!tracker[i]){
return i+1;
}
}
return 0;
}
```

}