挺简单的困难题
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
sort(nums.begin(),nums.end());
int n=nums.size();
int i=0;
bool b=0;
if(nums[0]>=0) b=1;
int p=1;
for(;i<n;i++){
if(i+1>0&&i+1<nums.size()&&nums[i]<=0&&nums[i+1]>0){
nums.erase(nums.begin(),nums.begin()+i+1);
i=0;
n=nums.size();
b=1;
}
if(b==1&&nums[i]!=p&&nums[i]!=p-1) {return p;}
else if(b==1&&nums[i]==p) p++;
}
return p;
}
};