You get two slices of integers, a and b.
Return a new slice with the values of a that are not in b.
Each value goes into the result only once. Keep the values in the order they first appear in a.
If every value of a is also in b, return an empty slice.
Example 1:
Input: a = [1, 2, 3, 4], b = [2, 4] Output: [1, 3] Explanation: 2 and 4 are in b, so they are left out.
Example 2:
Input: a = [5, 6, 5, 7], b = [7] Output: [5, 6] Explanation: 7 is in b. 5 appears twice in a, but only once in the result.
Example 3:
Input: a = [1, 2], b = [2, 3, 1] Output: [] Explanation: Both values of a are also in b, so nothing is left.
Constraints:
aandbeach have at least one number.- Every number is between -109 and 109.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
