class Solution {
public:
int removeDuplicates(vector<int>& nums) {
vector<int>ans;
int n=nums.size();
sort(nums.begin(),nums.end());
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
if(nums[i]==nums[j])
{
nums[i]=nums[j]=-1;
}
}
}
for(int i=0;i<n;i++)
{
if(nums[i]<0)
ans.push_back(nums[i]);
}
}`
return nums ; `
};
` i am not getting the ouput,it is showing this
error: expected member name or ';' after declaration specifiers return nums ; ^
Aucun commentaire:
Enregistrer un commentaire