Suppose we have an array called nums and another value k, we have to check whether LCM of nums is divisible by k or not.
So, if the input is like nums = [12, 15, 10, 75] k = 10, then the output will be True as the LCM of the array elements is 300 so this is divisible by 10.
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
def solve(nums, k) : for i in range(0, len(nums)) : if nums[i] % k == 0: return True nums = [12, 15, 10, 75] k = 10 print(solve(nums, k))
[12, 15, 10, 75], 10