1325B. CopyCopyCopyCopyCopy - Codeforces Solution C++

  Problem Link : 1325B. CopyCopyCopyCopyCopy 


✅ C++ Solution :

 
#include<bits/stdc++.h>
using namespace std;

#define ll long long int

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,v;
		cin>>n;
		unordered_set<ll> us;
		ll ans=0;
		for(ll i=1;i<=n;i++)
		{
			cin>>v;
			if(us.find(v)==us.end())
			{
				us.insert(v);
				ans++;
			}
		}
		cout<<ans<<"\n";
	}
}

 

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook. 

😇Happy Learning!!