Write a function uncommonNumbers(a, b) that returns the numbers that are in exactly one of two arrays.
a and b are arrays of integers, zero and negative numbers too. They can be empty and can have repeated numbers.[1, 1, 2] and [2, 3] give [1, 3].a in the order of their first occurrence in a, then the numbers from b in the same way. Do not sort the result.A set of each array helps you check quickly if a number is in it.
uncommonNumbers([1, 2, 3, 4], [3, 4, 5, 6])Returns [ 1, 2, 5, 6 ]
uncommonNumbers([1, 1, 2], [2, 3])Returns [ 1, 3 ]
uncommonNumbers([1, 2], [2, 1])Returns []
Asked at JP Morgan · Source
uncommonNumbers([ 1, 2, 3, 4 ], [ 3, 4, 5, 6 ])[ 1, 2, 5, 6 ]uncommonNumbers([ 5, 6 ], [ 6, 7 ])[ 5, 7 ]uncommonNumbers([ 1, 2 ], [ 2, 1 ])[]Hidden tests run on Submit.