We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Find one or more numbers x, y , z etc.. such that
for x,
a is a factor of x (GCD)
b is a multiple of x
We need to check the numbers in the range from max(a) to min(b).
Loop through this range of integers and check numbers in 'a' divide the number without remainders. Also check x divides numbers in 'b' without remainders.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
Find one or more numbers x, y , z etc.. such that for x, a is a factor of x (GCD) b is a multiple of x
We need to check the numbers in the range from max(a) to min(b).
Loop through this range of integers and check numbers in 'a' divide the number without remainders. Also check x divides numbers in 'b' without remainders.