Anti Array

Published by werdna in

Given two arrays, return whether the two arrays are opposites of each other. That means both arrays are comprised only from elements a and b and the occurrences of these elements are swapped between the two arrays.

Examples

isAntiArray(["1", "0", "0", "1"], ["0", "1", "1", "0"]) ➞ true

isAntiArray(["apples", "bananas", "bananas"], ["bananas", "apples", "apples"]) ➞ true

isAntiArray([3.14, true, 3.14], [3.14, false, 3.14]) ➞ false

Notes

All tests will include only two different elements.

Watch a quick demo on how Edabit works.