Skip to content

Instantly share code, notes, and snippets.

@karagenit
Created November 19, 2017 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karagenit/1347030506af039d3ab04929be152fc5 to your computer and use it in GitHub Desktop.
Save karagenit/1347030506af039d3ab04929be152fc5 to your computer and use it in GitHub Desktop.
// TODO: fix imports
public class EfficientSwap {
/**
* This method should print its parameters in opposite order.
* E.g. swap(3, 4) should print 4 then 3.
*/
public static void swap(int a, int b) {
a = a * b;
b = a / b;
a = a / b;
// NO MORE CODE BEYOND THIS POINT
System.out.println(a);
System.out.println(b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment