Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 408 Bytes

File metadata and controls

23 lines (18 loc) · 408 Bytes

Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.

Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].

Note: Each element in the result must be unique. The result can be in any order.

Solutions:

Swift

O(n)

C++

O(n)

Installation

Run make to build and run C++ files and run Swift files. Or you can run .playground file.