分析:
跟上道题一样,但是可以重复
代码:
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ count=[] if len(nums1)<len(nums2): for i in nums1: if i in nums2: count.append(i) nums2.remove(i) elif len(nums1)>len(nums2): for i in nums2: if i in nums1: count.append(i) nums1.remove(i) else: for i in nums1: if i in nums2: count.append(i) nums2.remove(i) return count
标签:count,交集,List,II,int,append,350,nums1,nums2 From: https://www.cnblogs.com/ooooopppp/p/17374450.html