I'm trying to subtract an array from another array taking frequency into account, like this:
[1,2,2,2] some_code [1,2] # => [2,2]
What's the easiest way to accomplish this?
Using -
removes all occurrences of the elements in the second array:
[1,2,2,2] - [1,2] # => []