If i got two int lists where i want to compare these numbers is it ok
If i got two int lists where i want to compare these numbers is it ok to use a for loop and a contain to check each number or is this a slow way to check the numbers. If so how would you do. The numbers isn't at the same place in the list if they exist of course.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Rajanikant HawaldarRank #107 · 20.6K reputationPosted Feb 9, 2021, 12:40 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Feb 9, 2021, 12:18 AM EST
Jignesh KumarRank #91 · 22.9K reputationPosted Feb 9, 2021, 12:29 AM EST
Var numberExistsInBoth = listA.Intersect(listB).ToList(); var numberExistsInAbutNotInB = listA.Except(listB).ToList();