sol: https://ide.codingblocks.com/s/382611
prob: https://hack.codingblocks.com/app/contests/1975/173/problem
I have commented the code for convenience. It is giving me some error when I print out the data store so far in the freqeuency table
sol: https://ide.codingblocks.com/s/382611
prob: https://hack.codingblocks.com/app/contests/1975/173/problem
I have commented the code for convenience. It is giving me some error when I print out the data store so far in the freqeuency table
updated sol :https://ide.codingblocks.com/s/382611
the last loop which is supposed to store the answer is not working correctly. rest is working fine
Hey @raghav007
I dont know why u are writing so much of code
Please share ur algo
This is simplified version of what I understood u are doing
for(int i = 0; i<n1; i++){
f1[a1[i]]+=1;
}
for(int i = 0; i<n1; i++){
f2[a2[i]]+=1;
}
int first=true;
for(int i=0;i<=100000;i++){
for(int j=0;j<min(f1[i],f2[i]);j++){
if(first==true){
cout<<"["<<i;
first=false;
}else cout<<", "<<i;
}
}
cout<<"]";
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.