Subtraction Game 2
Chef is playing a game on a sequence of $N$ positive integers, say $A_1, A_2, ... A_N$ The game is played as follows. * If all the numbers are equal, the game ends. * Otherwise * Select two numbers which are unequal * Subtract the smaller number from the larger number * Replace the larger number with the result from above Chef has already figured out that the game **always
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.
Sign in to chat with the tutor and save your progress.
Sign in to start