 What's up guys? My name is Michael and welcome to my YouTube channel. So we today we are going to go over cool pairs easy again because yesterday, I actually did not check if my My solution passed the system tests and it actually didn't pass. So that was the thing Yeah, we are going to go over this problem again One of the subscribers actually told me that my solution did not pass the system test So yeah, we're gonna go over the solution again, and I'll show you the right solution. Okay? So in this problem statement, you're given n people each person in the group has a first name and a last name the names of the person are A first name at I last name at I right so basically you have two arrays one is named first name and the other one's last name Okay, A and B are two different people such that the last name of person a is the same as a first name a person B The order pair a B is called cool. Okay, so if they have two different people and the last name Of the same thing as the first name B, then the order pair a B is cool. Okay, so now you have to calculate the number of cool pairs Okay, so to do this Well first you have to create your method signature of class cool pairs easy count Two strings on so yeah So to do this problem, I Didn't actually check if they were the same pair, right? So loop from I plus one when that's actually not what you should do So here well, here's the right solution. You have count If the method count you start your Number of pairs that are the same is going to equal to zero, right? That's n you're gonna loop from zero to the end of The array of first name and here for each of that you're gonna check loop from zero to the end of last name Right, so here's what I had Correctly before I did J equals to I plus one and that's not right because we don't know if the Ith name is equal to the jth name, right? We don't know if that's the case, right? So doing I plus one Because we don't know if that's the case the I plus one would be wrong because we don't know if that's corresponding to the same person, right? So for each of the first name, we're gonna go loop through for each of the last name and we are going to check If the first name at I is equal equal to the last name at I then we we also have to check if I is not equal to J because if it's not equal to J that means there are different people, right? So Here the index of I remember they said that They said that If a and b are two different people such that the last name of person a is the same I think as First name person B. So yeah, you have to start from zero also Start from zero and then if I is not equal to J We have to check at first name at I is equal to last name at J Right because that checks if they have the same first name and the last name right Person a has the same first name as person B a last name as person B Okay, and that would basically check your answer Increment the number of pairs and plus plus and then return n So that's basically just how to do this problem I'm gonna create another video after this shortly after this about the how to submit on How to compete on top coder because competing on top card is kind of difficult. Yeah So in order to check if this actually ran here's where you have to you have to click compile Once it's compiled you're going to go to test panel check all the tests and then run them all them and Then see if you got all them and then if since we did now we just submit. Yeah Okay So yeah, that's pretty much it. That's just a bit Ready to come subscribe. I'll check you guys later. Peace