国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

Intersection of Two Arrays

2019-11-08 20:16:13
字體:
供稿:網(wǎng)友
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.
class Solution(object):def intersection(self, nums1, nums2):    """    :type nums1: List[int]    :type nums2: List[int]    :rtype: List[int]    """    nums1=set(nums1)    nums2=set(nums2)    return list(nums1&nums2)
class Solution(object):    def intersection(self, nums1, nums2):        """        :type nums1: List[int]        :type nums2: List[int]        :rtype: List[int]        """        res = [str for str in nums1 if str in nums2]        return list(set(res))
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 永和县| 泗阳县| 杭锦旗| 科尔| 陆丰市| 沂水县| 南城县| 石台县| 苗栗县| 永春县| 南川市| 法库县| 绵竹市| 祁东县| 通化县| 秦安县| 特克斯县| 苍溪县| 黑山县| 保靖县| 平原县| 商都县| 汉川市| 仁布县| 鲁山县| 伊川县| 双峰县| 米易县| 鄯善县| 吉林省| 嘉祥县| 娱乐| 新闻| 兴安县| 扬中市| 祥云县| 九龙县| 正蓝旗| 沈阳市| 杭锦后旗| 黎川县|