Google | Phone Screen | Difference between 2 lists
Anonymous User
1143

Given list A and B, write a function that returns
l1 - A list that contains members in A but not in B.
l2 - A list that contains members in B but not in A.

There might be duplicate numbers in these lists.
Example 1:

	A = [2,3,1,4]    B = [10,5,3,2]
	l1 = [1,4]    
	l2 = [10,5]

Example 2:

	A = [1,1,12]    B = [2,1,3]
	l1 = [1,12]    
	l2 = [2,3]

Follow up: Can you do it in O(1) space complexity? Ignore the space for outputs l1, l2.

Comments (7)