Azienda coinvolta
The question was "How do you swap two values without creating a new variable?"
Anonimo
I didn't answer the question correctly, but I looked it up later and found it: a = a XOR b b = a XOR b a = a XOR b
I liked solution using XOR. We can do it with +/- as well. If we know numbers are less than some integer limits. a= a + b b = a -b a = a- b
Non lasciarti sfuggire opportunità e informazioni privilegiate seguendo le aziende dove vorresti lavorare.
Ricevi suggerimenti e aggiornamenti personalizzati avviando le tue ricerche.