Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> example([1, 2, 3], [3, 3, 4, 5])
- 1
- >>> example([1, 1, 2, 3, 4], [1, 2, 3, 4])
- 4
- //this is python, comments if you aren't familiar
- def example(list1, list2):
- count = 0
- //for every item in list1
- for item in list1:
- //if list2 contains that item
- if item in list2:
- count += 1
- //remove the first occurrence of item from list2
- list2.remove(item)
- return count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement