I was asked this question today in uber hiring contest. I dont have even a hint how to solve this problem.
Any suggestions?
There is black box and a white box (both empty initially), and N pairs of numbers (x 1, y1) ... (xn, yh). For each pair, you have to put one number in the black box and on e on the white box.
After this, let A be the GCD of all numbers in the black box, and B be the GCD of all numbers in the white box. The final score is the LCM of A and B.
What is the maximum score you can achieve