Samstag, 25. Oktober 2014

so this is an interview question for a programmer:

swap two variables without a temporary variable

well

a=3
b=5

a=a+b
8=3+5

b=a-b
3=8-5

a=a-b
5=8-3

a=5
b=3

greetz WV

Keine Kommentare:

Kommentar veröffentlichen