Take 500 of the bottles and put one drop from each of them into an empty bottle. Taste the juice in that bottle. If it's bitter, you know the poison is in one of them; if not, it's in one of the other 500. Now, take 250 of the bottles you've chosen and put one drop from each into another empty bottle and taste it. Now, you've narrowed it down to 250 bottles. Repeat, and narrow it down to 125... then 63... then 32... 16...8... 4... 2... and finally 1. And you only had to taste the juice 10 times, instead of possibly 999.
there are 1000 bottles and one is spoiled !!
NICE ! now our job is to detect the spoiled 1 with minimum
sips .... hmmmm think like sherlock holmes now !
probability of finding that one in 1000 is 1/1000
divide those 1000 into 4 parts 250 ,250, 250, 250
well well well now as i told only one is bitter means, it is
alkaline and it will turn a red litmus paper (ph paper) into
now collect a litmus paper from nearest store and start
dipping in first 250 bottles block !!
voila !! if it turned to blue , that one is the infected one
!! and u spotted it without even sipping :P
One train leaves Los Angeles at 15mph heading for New York.
Another train leaves from New York at 20mph heading for Los
Angeles on the same track. If a bird, flying at 25mph,
leaves from Los Angeles at the same time as the train and
flies back and forth between the two trains until they
collide, how far will the bird have traveled?
A traveler walks a certain distance. Had he gone half a
kilometer an hour faster , he would have walked it in 4/5
of the time, and had he gone half a Kilometer an hour
slower, he would have walked 2 ½ hr longer. What is the
There are two sorted arrays
a1 and a2 of size n1 and size n2 respectively.
array a1 is full
array a2 has exactly n1(size of array a1) empty space.
a2=56789_ _ _ _
Write a function to merge these two arrays to form a sorted
array without any extra memory use.
i want a solution in c/c++ language