Loading...
Engaged Employer
How do you swap variables without using a temporary variable? Assume the variables are always integers.
Anonymous
Shouldn't the last line be b = b - a;
// Example, a = 4, b = 3; void swap (int a, int b) { b = a + b; // b = 7 a = b - a; // a = 3 b = b - b; // b = 4 }
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalized job recommendations and updates by starting your searches.