How to Subtract Arrays in Python
The challenge
Implement a difference function, which subtracts one list from another and returns the result.
It should remove all values from list a
, which are present in list b
keeping their order.
|
|
If a value is present in b
, all of its occurrences must be removed from the other:
|
|
The solution in Python
Option 1:
Option 2:
Option 3:
Test cases to validate our solution
|
|