1. How will you find n largest pair (a[i], b[j]) from two sorted array A and B
What I mean is .. There are two arrays A and B of length N each and both the arrays are sorted in descending order … Now we need to find the N largest pairs (a[i]+b[j]) from A and B.
Simply putting it is same as finding all the possible n^2 (a[i]+b[j]) combinations of sums from both the arrays and sorting them and them give back the first N numbers. 😉
2. You are given 2 dice. One of the dice is numbered 1 to 6. What should the other die be numbered so that when you roll the two dice the probability of getting a sum in the range 1-12 is same i.e probability of getting sum 1,2,…..12 is equal.
Note: The sum should be only within the range 1 – 12, no other values are permitted.