Intersection of Two Arrays
Convert both arrays to sets, intersect them, and sort the result if you want deterministic output for testing or interviews.
Return the unique values that appear in both arrays.
Convert both arrays to sets, intersect them, and sort the result if you want deterministic output for testing or interviews.
Convert both arrays to sets, intersect them, and sort the result if you want deterministic output for testing or interviews.
Return the unique values that appear in both arrays.