← Interval & Math

Micro-Drill #121 — GCD (Euclidean)

Interval & Math Target: 5s

The Euclidean algorithm is fundamental to number theory. O(log min(a,b)) complexity.

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

Type it from memory. Go.

Practice Problems

← Micro #120 Micro #122 →