From 300a1bda5399e342fbbd87d00bb900b1bd79df8a Mon Sep 17 00:00:00 2001 From: Vamshi Bachaneboina Date: Mon, 17 Sep 2018 16:05:06 +0530 Subject: [PATCH] Update js1.html Updated - Method 3 for GCD is a bit easier to understand than Method 2 and has better time complexity than Method 1 and equivalent to Method 2. --- js1.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js1.html b/js1.html index 80ce618..92584fe 100644 --- a/js1.html +++ b/js1.html @@ -277,6 +277,17 @@

fancy algorithm

}

Note: use your brain to understand it.

+ +

fancy euclidian algorithm

+

Better time complexity than Method 1 and equivalent to Method 2

+

+const GCD = (a,b) => {
+  while(a != b){
+    [a,b] = a > b ? [a-b, b] : [a, b-a];
+  }
+  return a || b
+}
+        

5. remove Duplicate