Sobes.tech
Junior — Middle+

Remove from one list the elements of another considering the quantity

livecode

Task condition

Create a function that takes two lists and returns the first list after removing all elements that are present in the second list, considering the number of their occurrences.

Example 1:

a = [5, 4, 2, 3, 8, 1]

b = [5, 2, 2, 1]

result = [3, 4, 8]

Example 2:

a = [5, 4, 2, 3, 8, 1, 2, 2]

b = [5, 2, 2, 1]

result = [2, 3, 4, 8]

Remove from one list the elements of another… - sobes.tech