USing the unordered_set:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[]={-3, -2, 0, 3, 4, 5};
int n=6;
unordered_set<int>us;
int count=0;
for(int i=0;i<n;i++)
{
us.insert(abs(arr[i]));
}
cout<<us.size();
return 0;
}
Top comments (0)