From bc56011f0c70c5259266c5ae4be758f2803128dd Mon Sep 17 00:00:00 2001 From: Heitor Date: Thu, 17 Oct 2019 03:21:41 -0300 Subject: [PATCH] swap using shift and log --- Swap-without-third-variable/09. shift_swap.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Swap-without-third-variable/09. shift_swap.cpp diff --git a/Swap-without-third-variable/09. shift_swap.cpp b/Swap-without-third-variable/09. shift_swap.cpp new file mode 100644 index 0000000..949eff8 --- /dev/null +++ b/Swap-without-third-variable/09. shift_swap.cpp @@ -0,0 +1,12 @@ +#include "bits/stdc++.h" +using namespace std; + +int main(){ + int a=5; + int b=9; + cout<<"a :"<>b; + a = log2(a/b); //just a little bit of math hahaha, hope it's right + cout<<"a :"<