I am confused when there are multiple values in a single set. Based on all the descriptions of Symmetric
Difference, the operation is a SET LEVEL comparison, not a comparison of ELEMENTS within a SET.
Thus I think the test is wrong…
For example is says this test – "sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]) should return [1, 4, 5]."
I think it should actually return [1,1,2,4,5]
Specifically they first set contains four elements 1, 1, 2 & 5. Although the number 1 is duplicated, for Symmetric Difference you are comparing ALL ELEMENTS in the first set with all elements in sets two and three. Since neither sets two or three contain a number one, all ones are valid. Furthermore if set two had only a single 1, then it would eliminate 1 of the number ones but not both.
Now if you said, “UNIQUE SET ELEMENTS” then I’d agree that the answer would be [1,4,5]