We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
C++ solution with std::map like a table of frequencies :
#include<iostream>#include<map>usingnamespacestd;intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */intn;cin>>n;map<int,int>freqeuncy;boolisTrue=true;for(inti=0;i<n;i++){intt;cin>>t;if(freqeuncy.find(t)==freqeuncy.end()){freqeuncy[t]=1;}else{isTrue=false;}}isTrue?cout<<"YES":cout<<"NO";cout<<endl;return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Security Bijective Functions
You are viewing a single comment's thread. Return to all comments →
C++ solution with std::map like a table of frequencies :