Your question is Compute GCD. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Workiva Wdesk validation utility needs to reduce two integer values to their greatest common divisor. Implement the Euclidean algorithm to return the largest positive integer that divides both inputs without a remainder.
Implement gcd(a, b), where a and b are non-negative integers. Return an integer representing their greatest common divisor. At least one input is guaranteed to be positive. The result must be non-negative.
You may use the identity gcd(a, b) = gcd(b, a % b) repeatedly until the second value becomes zero.
def gcd(a, b):