class Solution: def intersect(self, nums1, nums2): if len(nums1) < len(nums2): self.so(nums1,nums2) else: self.so(nums2,nums1) def so(self,nums1,nums2): list1 = [] for i in range(len(nums1)): if nums1[i] in nums2: list1.append(nums1[i]) nums2.remove(nums1[i]) return list1 def main(): xx = Solution() b = xx.intersect([1,2,2,1],[2,2]) print(type(b)) print(b) if __name__ == '__main__': main()
慕斯4360584
慕慕5436299
Zr_0118