△
ou ⊕
) dos arrays fornecidos. Dados dois conjuntos (por exemplo, conjunto A = {1, 2, 3}
e conjunto B = {2, 3, 4}
), o termo matemático "diferença simétrica" de dois conjuntos é o conjunto de elementos que estão em qualquer um dos dois conjuntos, mas não em ambos ( A △ B = C = {1, 4}
). Para cada diferença simétrica adicional que você tomar (digamos em um conjunto D = {2, 3}
), você deve obter o conjunto com elementos que estão em um dos dois conjuntos, mas não em ambos ( C △ D = {1, 4} △ {2, 3} = {1, 2, 3, 4}
). A matriz resultante deve conter apenas valores exclusivos ( sem duplicatas ). Lembre-se de usar Read-Search-Ask se você ficar preso. Tente emparelhar o programa. Escreva seu próprio código. sym([1, 2, 3], [5, 2, 1, 4])
deve retornar [3, 4, 5]
.'
testString: 'assert.sameMembers(sym([1, 2, 3], [5, 2, 1, 4]), [3, 4, 5], "sym([1, 2, 3], [5, 2, 1, 4])
should return [3, 4, 5]
.");'
- text: 'sym([1, 2, 3], [5, 2, 1, 4])
deve conter apenas três elementos.'
testString: 'assert.equal(sym([1, 2, 3], [5, 2, 1, 4]).length, 3, "sym([1, 2, 3], [5, 2, 1, 4])
should contain only three elements.");'
- text: 'sym([1, 2, 3, 3], [5, 2, 1, 4])
deve retornar [3, 4, 5]
.'
testString: 'assert.sameMembers(sym([1, 2, 3, 3], [5, 2, 1, 4]), [3, 4, 5], "sym([1, 2, 3, 3], [5, 2, 1, 4])
should return [3, 4, 5]
.");'
- text: 'sym([1, 2, 3, 3], [5, 2, 1, 4])
deve conter apenas três elementos.'
testString: 'assert.equal(sym([1, 2, 3, 3], [5, 2, 1, 4]).length, 3, "sym([1, 2, 3, 3], [5, 2, 1, 4])
should contain only three elements.");'
- text: 'sym([1, 2, 3], [5, 2, 1, 4, 5])
deve retornar [3, 4, 5]
.'
testString: 'assert.sameMembers(sym([1, 2, 3], [5, 2, 1, 4, 5]), [3, 4, 5], "sym([1, 2, 3], [5, 2, 1, 4, 5])
should return [3, 4, 5]
.");'
- text: 'sym([1, 2, 3], [5, 2, 1, 4, 5])
deve conter apenas três elementos.'
testString: 'assert.equal(sym([1, 2, 3], [5, 2, 1, 4, 5]).length, 3, "sym([1, 2, 3], [5, 2, 1, 4, 5])
should contain only three elements.");'
- text: 'sym([1, 2, 5], [2, 3, 5], [3, 4, 5])
deve retornar [1, 4, 5]
'
testString: 'assert.sameMembers(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], "sym([1, 2, 5], [2, 3, 5], [3, 4, 5])
should return [1, 4, 5]
");'
- text: 'sym([1, 2, 5], [2, 3, 5], [3, 4, 5])
deve conter apenas três elementos.'
testString: 'assert.equal(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]).length, 3, "sym([1, 2, 5], [2, 3, 5], [3, 4, 5])
should contain only three elements.");'
- text: 'sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5])
deve retornar [1, 4, 5]
.'
testString: 'assert.sameMembers(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], "sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5])
should return [1, 4, 5]
.");'
- text: 'sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5])
deve conter apenas três elementos.'
testString: 'assert.equal(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]).length, 3, "sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5])
should contain only three elements.");'
- text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3])
deve retornar [2, 3, 4, 6, 7]
.'
testString: 'assert.sameMembers(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]), [2, 3, 4, 6, 7], "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3])
should return [2, 3, 4, 6, 7]
.");'
- text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3])
deve conter apenas cinco elementos.'
testString: 'assert.equal(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]).length, 5, "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3])
should contain only five elements.");'
- text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1])
deve retornar [1, 2, 4, 5, 6, 7, 8, 9]
.'
testString: 'assert.sameMembers(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]), [1, 2, 4, 5, 6, 7, 8, 9], "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1])
should return [1, 2, 4, 5, 6, 7, 8, 9]
.");'
- text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1])
deve conter apenas oito elementos.'
testString: 'assert.equal(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]).length, 8, "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1])
should contain only eight elements.");'
```