← All problemsSign in

GAME OF TWO NUMBERS

You are given $2$ positive integers $a$ and $b$. Consider integers $x$ , $y$ , $u$ , $v$ where $x = u = a$ $y = v = b$ You have to perform the following operations : - if $x>y$ change $x$ $\rightarrow$ $x-y$ and $u$ $\rightarrow$ $u+v$ - if $y>x$ change $y$ $\rightarrow$ $y-x$ and $v$ $\rightarrow$ $v+u$ - if $y=x$ stop performing any more operations Find the value of $(u+v) - (x+y)$ wh

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start