MEENA AND GCD
CodeChefOpen on judge ↗
Meena has two positive integers M and N. Now Meena wants to perform some number of operations (possibly zero) on them. In each operation, Meena can choose either M or N and increment it by 1. Find the minimum number of operations Meena needs to perform so that there is a positive integer strictly greater than 1 which divides both M and N (In other words, the greatest common divisor of M and N shou
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