A person wears black shoes, black pant, shirt goggles, and possibly everything is black. A car coming from the opp sides honks several times but this guy doesnt move. Eventually in the end he somehow averts the accident. How could the person see him tho he was wearing all black???
The Celebrity Problem
In a party of N people, only one person is known to everyone. Such a person may be present in the party, if yes, (s)he does not know anyone in the party. We can only ask questions like does A know B? . Find the stranger (celebrity) in minimum number of questions.
We can describe the problem input as an array of numbers/characters representing persons in the party. We also have a hypothetical function HaveAcquaintance(A, B) which returns true if A knows B, false otherwise.
We measure the complexity in terms of calls made to HaveAcquaintance().
By Ic Admin
This question was asked in Adobe interview.
There are 5 holes in the ground in a straight line and a frog lives in them. Every night the frog jumps to a hole on either side of current hole. If it's in the corner hole(say,1st), it will jump to the only adjacent hole(ie 2nd).If it's in hole 2 , it can jump either in hole 1 or 3. You can come in the morning and can have a look at any one hole in a day. Design a strategy to capture the frog in minimum number of days..
Because cigars cannot be entirely smoked, a Bobo who collects cigar butts can make a cigar to smoke out of every 3 butts that he finds. Today, he has collected 27 cigar butts. How many cigars will he be able to smoke?
8 balls of same size
If u have 8 balls of all the same size and 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?
By Shiva kumar
The Game of Master Mind
The Game of Master Mind is played as follows:
The computer has four slots containing balls that are red (R), yellow (Y), green (G) or blue (B) For example, the computer might have RGGB (e g , Slot #1 is red, Slots #2 and
#3 are green, Slot #4 is blue)
You, the user, are trying to guess the solution You might, for example, guess YRGB When you guess the correct color for the correct slot, you get a ?hit? If you guess
a color that exists but is in the wrong slot, you get a ?pseudo-hit? For example, the
guess YRGB has 2 hits and one pseudo hit
For each guess, you are told the number of hits and pseudo-hits
Write a method that, given a guess and a solution, returns the number of hits and pseudo hits
Kth number with only prime factors 3,5,7.
Design an algorithm to find the kth number such that the only prime factors are 3,5, and 7.
Two squares problem!!
Given two squares on a two dimensional plane, find a line that would cut these two squares in half
3 ants problem
There are three ants on different vertices of a triangle What is the probability of collision (between any two or all of them) if they start walking on the sides of the triangle?
Similarly find the probability of collision with "n" ants on an "n" vertex polygon