Solution in Python


  • 0
    V
    class Solution:
        def intersect(self, nums1, nums2):
            result = []
            for i in nums1:
                if i in nums2:
                    result.append(i)
                    nums2.remove(i)
            return result
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.