CareerCup provides technical interview prep for engineers.
→
amazon phone interview: Q. how do u multiply a no by 7..tell an efficient method
Q2: there r 7 buckets of water and infinite no for flies....one the buckets is poisoned...you need to find which 1 by putting the fly in it..bt it will take 7 days for the fly to die..and for u to know...tht d bucket is poisoned..also u need to send one of the buckets to ur friend in 1 week...hw will u find out the poisoned bucket in least no of flies?
this is also amazon qns
If we could take a sample of water from buckets, then make 2 groups, mix water from 1,2,3,4 and water from 5,6,7, At the end of 7th day, you would find corrupt group and you can send the bucket from clean group to the friend....using this idea you can find poison bucket in 21 days with 3 flies..
What do u think?
the interviewer wants us to find a method in which we r in a position to know which bucket is poisoned in 7 days..with min mo of flies
i said put 6 flies in 6 buckets and leave one without any..on the 7th day u ll know which 1 is poisoned..he wanted more optimized ans
without any further information, I do not think there is anything better than 6 because you need to test atleast 6 buckets and any water mixing approach is going to take more flies...
can't you do it in four? use fly1 for buckets 1, 2, 3, 4 and fly2 for buckets 5, 6, 7. fly3 for 1, 2. fly4 for bucket 1.
sorry, that was wrong. 3 flies. use fly1 for buckets 1, 2, 3, 4. fly2 for 1, 2. fly3 for bucket 1.
how do i build the word ladder?
@CC how can 3 flies solve this problem with the approach u said? what if the fly is in bucket 4,5,6 or 7? u can find a fly with above approach only in buckets 1 or 2
Well, if the fly1 doesn't die after trying 1, 2, 3 and 4, then you know bucket 5, 6, or 7 is poisoned. So then you have fly2 try a {5, 6} mixture.
(by the way, this is basically just binary search)
but 2nd try will be only after 7 days which is the basic problem
why is that a problem?
before 7 days u need to find the poison bucket
are you sure? that's not what the original problem said. "also u need to send one of the buckets to ur friend in 1 week"
you're trying to send your friend a NON-POISONED bucket
thats what I was corrected by the guest793889
I also thought the same as u initially
I think he misinterpreted the problem...
even I feel so..
why would you send your friend a poisoned bucket? that doesn't make sense
he originally typed "u need to send one of the buckets to ur friend in 1 week". I think he didn't see the difference between the two problems...
anyway, if you need to know which bucket is poisoned within 7 days, then the best you can do is 6 flies.
@CC since u have interviewed people at many places and have been part of hiring committee can u tell why companies like Amazon, MSFT and Google conduct 2 or 3 phone interviews..
I stay close to them...still amazon is having 3rd phone interview with me
many places?
and I believe even MSFT and Goog does the same thing...
in general, it's because interviews are incredibly expensive. It costs $1000 - $1500 to do a round of interviews with someone.
does it mean a weak candidate or more groups interested in u?
the companies need to do things to cut their costs, which means not bring unqualified people onsite
ok
any nice link for wild card pattern matching question
which language?
c will work
also what is *,? in c coding
i m getting confused with perl
U need to go thru a tutorial..i would suggest doing it in perl..as all other languages try to copy the features of perl
or rather have copied.
no i am asking from point of view of wild caRD pattern matching wquestion
simillarly algo for substring matching
?
can someone explain this? In perl: if $z="P01", how does $z++ = P02
for perl operation +, any leading part of string before number gets retained and number is added and trailing parts are removed, so if $z="P01ABC", $z++ = P02
thanks
http://careercup.com/question?id=686684
Any one please help me with the solution
how to get call 4rm amazon?
Chatting as guest795215.
Change name
|
admins
|
|
|
|
|
|
members
|
|
|
Loading members...
|
|
|
guests
|
|
|
Loading guests...
|
|



