An array containing the elements that are present in both arrays.
This function is useful for finding common elements between two arrays. It uses a Set
for efficient lookups, ensuring that the operation is performed in linear time relative to the size of the input arrays.
Returns the intersection of two arrays.