← Interval & Math
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.