Given three integers x, y, z, the task is to compute the value of GCD(LCM(x,y), LCM(x,z)) and return the value.
Where, GCD = Greatest Common Divisor, LCM = Least Common Multiple.
Input: x = 15, y = 20, z = 100
Explanation: GCD(LCM(15,20), LCM(15,100))
Input: x = 30, y = 40, z = 400
Explanation: GCD(LCM(30,40), LCM(30,400))
You don't need to read input or print anything. Your task is to complete the function findValue() which takes x, y, z as inputs and returns the answer.
Expected Time Complexity: O(max(log x, log y, log z))
Expected Auxiliary Space: O(1)
1 ≤ x, y, z ≤ 106
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.