Created
May 6, 2020 14:58
-
-
Save vicxruiz/26179ec39c282f90a448f80dd2918632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given two arrays, write a function to compute their intersection. | |
Example 1: | |
Input: nums1 = [1,2,2,1], nums2 = [2,2] | |
Output: [2] | |
Example 2: | |
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] | |
Output: [9,4] | |
Note: | |
Each element in the result must be unique. | |
The result can be in any order. | |
func intersection(_ nums1: [Int], _ nums2: [Int]) -> [Int] { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment