The first question is to write the binary search. Remember the bug of mid=(lo+hi)/2, instead, you should write mid=lo+(hi-lo)/2. The second question asked, how to find two missing integers in an unsorted array. You should first find the sum of the two numbers, and then the XOR of the two numbers. The third question asks you are given a number of coins, how can you generate the probability of 1/3, 2/3, etc. I answered that just use two coins to do so. Toss two coins, you have 4 possibilities, HH,HT,TH,TT. Assign the 1/3,2/3,3/3 values to the first three. If you meet tail,tail, just toss again.