```
class Solution {
public:
vector<int> findErrorNums(vector<int>& nums) {
int len = nums.size();
vector<int>count(len+1,0);
for(auto e : nums) count[e]++;
vector<int>ans(2,0);
for(int i = 1; i <= len; i++)
{
if(count[i] == 0) ans[1] = i;
if(count[i] == 2) ans[0] = i;
}
return ans;
}
};
```