ACM CodeFest 2.0 - MINLCM Editorial

Editorial for MINLCM

The quantity defined by (x∗y)/LCM(x,y) is the GCD. The minimum possible GCD for any pair of numbers is 1.

The GCD of any 2 consecutive numbers is 1. Therefore we can pick L and L+1 as the answer because their sum is minimum possible.

To ensure that the sum also lies between L and R we have to check that 2 * L + 1 <= R

Code Link: MINLCM