Code Room
CodingMedium
Question
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.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.