Find the Difference of Two Arrays LeetCode solution in Python
1# Runtime: 953 ms (Top 29.31%) | Memory: 14.3 MB (Top 52.22%)2class Solution(object):3def findDifference(self, nums1, nums2):4"""5:type nums1: List[int]6:type nums2: List[int]7:rtype: List[List[int]]8"""9a = []10for i in range(len(nums1)):11if nums1[i] not in nums2:12a.append(nums1[i])13b = []14for i in range(len(nums2)):15if nums2[i] not in nums1:16b.append(nums2[i])1718c = [list(set(a))] + [list(set(b))]1920return c