```
class Solution {
public:
vector<int> findDuplicates(vector<int>& nums) {
vector<int>res;
int len = nums.size();
for(int i = 0 ; i < len ; ++i){
int x = abs(nums[i])%len;
if(nums[x]>0){ nums[x] = -nums[x] ;}
else res.push_back(abs(nums[i]));
}
return res;
}
};```
```