package com.sunny.grokkingalgorithms.fasttrack.ctcimedium;

/**
 * Created by sundas on 6/16/2018.
 */
public class SwapTwoVariablesWithoutTemp {

  /**
   *
   * @param args
   */
  public static void main(String[] args) {
    int a = 5;
    int b = 6;
    System.out.println(a);
    System.out.println(b);
    a += b;
    b = a - b;
    a -= b;
    System.out.println("swap");
    System.out.println(a);
    System.out.println(b);
  }

}

Swap two numbers without using any temp variables. O(1)
Swap two numbers without using any temp variables. O(1)
