Algorithms - Find the Symmetric Difference

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

function sym(...args) {
    let [args0, ...argsRest] = args
    for (const arg of argsRest) {
     let arrAux = []
     for (element of args0) {
         arg.includes(element) || arrAux.includes(element) ? (null) : (arrAux.push(element))
     }
     for (element2 of arg) {
         args0.includes(element2) || arrAux.includes(element2) ? (null) : (arrAux.push(element2))
     }
     args0 = arrAux 
    }
    return args0.sort();
 }

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Challenge: Algorithms - Find the Symmetric Difference

Link to the challenge:

Can someone help me out with this?

I’ve tested it myself and it runs properly on each one of the tests. I don’t say it’s the best or most optimal solution but I know it runs.

Did this happen to anyone else when solving the excercise?

Thanks!

Weird! I do not

And it actually runs smoothly in VSC

Okay, found the error, my bad, I was not defining the “iterable elements” within each one of the inner loops.

Just checked it by calling the function after the code shown above.

Thanks!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.