Sobes.tech
Senior

Write a function Exclude that returns elements from slice a that are not in slice b.

sobes.tech AI

Answer from AI

The function creates a set from the elements of slice b for quick lookup, then iterates over a and adds to the result only those elements that are not in b. This is efficient in terms of time — lookup in the map is O(1).