leetcode 349. Intersection of Two Arrays python
349. Intersection of Two Arrays --leetcode
编程练习,多多思考。题很简单,我自己总结了下 set 的集合运算见此
题目
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.
python解法
1 | class Solution(object): |