Extended GCD coefficients
Given two positive integers a and b (1 <= a, b <= 1e9), return [g, x, y] where g = gcd(a, b) and x, y are Bezout coefficients satisfying a*x + b*y = g. The reference produces the canonical coefficients yielded by the iterative extended Euclidean algorithm; tests compare against those exact values.
Implement
extended_gcd(a: int, b: int) → list[int]Examples
in
[30,20]out[10,1,-1]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 25 min
solution.py
InputExpectedGot
[30,20][10,1,-1]not run yetsample