How can I find the intersecttion between 2 arrays in C#, in a fast way?
To find the intersection of two arrays in java use two loops. The outer loop is to iterate the elements of the first array whereas, the second loop is to iterate the elements of the second array.
C = intersect( A,B ) returns the data common to both A and B , with no repetitions. C is in sorted order. If A and B are tables or timetables, then intersect returns the set of rows common to both tables.
There's the Intersect extension method on Enumerable. It works on any IEnumerable<T>
including arrays.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With