Persistent Systems Interview Question

T2 round Coding que was based on GCD and LCM.