# Interview questions in San Jose, CA

www.google.com / HQ: Mountain View, CA

2,141 Interviews in San Jose (of 10,210)

www.apple.com / HQ: Cupertino, CA

1,202 Interviews in San Jose (of 7,212)

Cisco Systems Interviews in San Jose

www.cisco.com / HQ: San Jose, CA

651 Interviews in San Jose (of 3,537)

## Interview Questions in San Jose

### Local Data Quality Evaluator at Google was asked...

How many cows are in Canada 101 AnswersIt depends......... Ask the folks at Department of ... whichever the department that already has this information. There is no need to start from scratch if this information is already available from a trustworthy source. But, if this department doesn't exist, then we can start by: - estimating the population of Canada - the number who drink cow milk and how much - the percentage of milk imported - the percentage of milk exported - the percentage of milk wasted - the percentage of milk used in other products - the amount of milk produced by a cow - from these numbers, get an estimate of the number of cows The approach should be as follows, please correct or improve the answer. 1. Estimate how much cow milk is produced in a day in Canada before it is processed and so on. A cow produces milk everyday except except for a time before it becomes pregnant with another calf. Read more: http://wiki.answers.com/Q/Does_a_cow_give_milk_every_day#ixzz2HiOmEXWc 2. Find out how much milk a cow produces per day on an average. 3. Divide #1 by #2 and you should have an answer. This is an approx answer. Show More Responses 111111111 if u hav doubt on it go and count it Let me Google it The number of cows is irrelevant, as long as each region in Canada has a high enough percentage of bovine to supply a stable flow of milk, cheese, ect. So by assuming cows are only used for milk production, the first two answers are already wrong. What about meat production? Less than the US. since the dept of agriculture does follow each registered cow, that number would be supplimented by the estimated number of non-registered cows. The number is variable dependant on time of year, supply and demand. Reproduction is cyclical, therefore the average would vary throughout the year. And so far as meat production, cattle are produced for meat, cows for dairy. 13.2 million according to WolframAlpha. :-) To which Cows do you refer? Are you strictly speaking about bovine cows, or do you also want to include Elk, Moose, etc? I don't know, however I am sure that if required to find this information I could. Zero. There are no 'cows' in 'canada'. Or I guess 0.25 since they share the letter c. Show More Responses http://dairyinfo.gc.ca/ says about 1.5 million dairy cows and heifers, and http://www.thecanadianencyclopedia.com/ says about 5 million beef animals. so, about 6.5 million head, for about 35 million Canadian humans. Send bunch of Google guys to count the cows. After that they will probably stop asking those questions. None - that I know personally Just as many as there need to be. Google it! Mooooooore than enough All of them. Count the number of cow legs and divide by 4 - duh. which variety, the four legged or two legged type? Utter ly ridiculous. Eat more chicken. Show More Responses I don't know, but if you hire me I'll find out for you. Define "cow." It depends on the day. Cow consumption varies greatly day by day. The only thing i can think to say is... it's an endlessly changing number. cows are born, cows die, cows are eaten, cows are cloned... at this very second there are cows in the process of doing all of those things, and there are cows simply going about their lives. there is no exact number. but there are a lot. Does this include only real, living cows, or are we also including stuffed animals? Statues? Milk and/or meat producing cows? Cows that can reproduce? Cows which have been sterilized? Are we including calves, or only those cows of a certain age or higher? This type of question is about identifying your thought processes...not providing an actual answer. Count the number of cow legs and divide by 3.999 (some small number of cows are maimed). There are 13 billion, 796 million, 463 thousand, 755 hundred, 74 cows in Canada as of 3 pm today. This does not incllude those butchered for consumption this evenings meal. This would also depend on how many people were ordering steak or beef of some kind. Then there are those who don't eat beef, they eat chickin, or fish or pork, or ribs, or those that eat pork chops, or those that just eat salad. So the number still lies in those research people who have to go count the number of legs on the cows, hence they need to not stand directly behind the cow or they will get on of two kinds of showers, I will get back to you on this. So, this is actually my original post after my interview with Google. There is no correct answer, they really want to see your thought process. The way I answered the question and I did get hired, was; "First I would have to know are we talking all cows or cows for producing dairy, or brown cows, female cows.....etc.?" My interviewer said, "All cows." I said, "Well first we have to know how many farms are in Canada. Then we could find out the maximum number of cows each farm is allowed to have and research with the dept. of Agriculture whether all of the registered farms are at maximum occupancy. We also have to take into consideration are their pregnant cows, and how many are slaughtered each month, thee has to be an allowance with that also." Anyway, I got hired at Google for the position listed above all to find out thta they were hiring shoe sales associates, and MAC makeup sales associates for this same position. LOL. Totally entry level. SKB and 13th we must have similar processors, lol, your answers are similar to how I responded!! I have'nt read the others yet, I'm making my way up the list. Its cool to see all of the different thought processes we all have. Show More Responses African or European cows? Over 9000 ! more than 1,00,000 n counting Forget the Cows! The U.S funding that I would love to have had control of is the $600,000 grant to study the effects of Rum on the citizens of the Dominican Republic. I figured it to be a 2 year study. $400,000 for my time, and $200,000 worth of rum for all of my newly snockered Dominican friends. Ciao, baby. Math.round(totalFarms / 4) == totalCows; Simple, count the number of cow legs in Canada and divide by four. "I was reading an article about this the other day. The latest official estimates are between 6.3 and 6.7 million cows. However, this figure is disputed by the independent Cow Quantities Authority in Qubec, who believe that the figure has been artificially inflated by up to 20% for political reasons. Most academics in Canada support the Cow Quantities Authority's suspicions, but not the scale of the alledged inflation." Okay, most everyone is over-thinking this. One poster got it right. How many "cows" in "Canada"? There are no cows in the word Canada therefore the answer would be no. If you look at the question as most everyone above has looked at it, you are over-thinking too much. Interviewers want to see how you think not how many real cows are in the country of Canada. Unless the company is involved with agriculture and cows. Here's a tip to get through an interview easier: go into the interview with the assumption that YOU are interviewing the INTERVIEWER. If they ask you weird questions, why? What is their thought process? Once you start seeing them as someone you question the interview goes a little easier. Try it, you'll see. British scientists found out that all cows in Canada are actually bulls. Google interviewers are not aware of that research and still counting Canadian cows. It could be 9,999. If someone does not believe it, can start counting. If it is found out more after counting, then the case would the visitors who come to visit relatives from neighbouring country; if it is less, then the case would be the cows from canada are visiting neibouring country to see their relatives or they could be eaten. Show More Responses One or less extra, depending whether your wife is Canadian. Duh. They are looking for you to say - I'd google it. Come on. My answer would be 3.5 million. The population of Canada is about 35 million. I surmise that there is probably one cow for every ten people. I doubt the interviewer cares if I know how many cows there are, but how to think it through to a possible answer with little to no information to go on. If we're looking at the colloquial term for a female bovine, there's many other species called cows: whales, manatees, giraffes, termites, crocodiles and alligators, bison and buffalo...and more. They probably just care that you don't make something up, but actually give it thought. Unlike Jerry... I would ask the interviewer "what is the purpose of asking this question and how is it related to the interview" As many as the young one of the cows....... According to BCG matrix in Management , product lines of an organisation which have high market share, low business growth and generates high profits and cash fall under cash cows category. So those organisations product portfolios in Canada comes under cash cows are the total no. of cows in Canada . More than 1 for sure and less than 10 million. For accurate estimation I would require to work on this project. X+1 Ask to google / search on google and you will defiantly get the right answer. Show More Responses more than one way to find out, here is one: -find out the annual number of slaughtered and exported cows that should be a close enough answer less than the total no.of cows in the remaining countries. In making the answer seem reasonable, keep in mind that Canada is not all that huge. Yes, the land mass is great, but the majority of it's population is much closer to the USA. Yes, they have farms, but don't they export much of their beef to the USA? Canada is a great grain producing country, so their beef/milk producing industry is self sustaining. Having said that, I would look at the interviewer and say, "If you are really interested in the details, and facts, just hire me for the job and i won't disappoint. " (with my new $150,000 salary, my company car, and a $50,000 yearly expense account, I would personally drive my way through Canada and visit every farm in that country. I would meet their families, and check out their daughters...............Lots of huge family farmlands, and great looking daughters to choose from?) During the 3 years, would look at my best opportunity, settle down and get married. We would have about 4 to 6 children, to keep her parents and us happy. My daily bonus check was marrying a girl who had the best milking hands in the county. After feeding the company all of the information that I had assembled, I would call them up and tell them that i quit. Mmmmmmmooooooooooooooo.................................. many two thousand hundred. knew this one. hew not for specific............ but cow not less than2 & more than 15000 There are 5768 cows, anything less means some have gone to the neighbouring areas and anything more means some have migrated into the region to meet their kin... can't comment cz without any given problem value it's nt easy to guess,,,,,,,,,,,,,, n it's also out of sylabus ,,,,,,,,,,,,,,,, "I don't know!" HALF THE DOUBLE Show More Responses 100% no 'cows' in 'canada'... first I thought of their competitors, milking the cows; but, when I looked at the job for which this question was asked, I understand how valid(ity) the question is.. may be not floats or fractions... nice people & machines are really working, I googled (as one reply says) I found wiki answer as, "about 7 million cows in Canada", I will be in trouble if it is 6.9Mn.... no interview question is a correct question and no answer is a wrong answer, when you are looking for leaders! There are 0 cows in Canada. The plural of cow is kine. 250000 cows More than 1, as the question itself says that there are more than 1 (cows). Candian women are all skinny. @Canadian guy. Many of the Canadian girls, within 25 miles of the USA border are on the slender side..............which is not bad in itself. Above that 25 mile zone, you will find the prize that you seem to be looking for. A good person to talk to, solid body, can deal with long winter weather, and a rather good cook. If you invest the time to know and appreciate her, your nights will never be lonely. As for your comment about Skinny Canadian girls? I was told by 2 Canadian girls, who worked in one of those border shops, that they prefer to go to the American side to have their fun and meet guys. They told me that the American guys like to have fun and they spend their money. What are you saving up for, Canadian guy? Is this the sort of projerct this position entails? If so, perhaps I should interview with a company that has a chance at remaining operational. The correct answer is "I don't know." They are testing to see whether you will make up a random answer, a wise-ass answer (no "cow" in the word "Canada"), refuse to accept that you don't know the answer, or waste time trying to find the answer to something you will never know (well, not accurately). Show More Responses They invented Wolfram Alpha for questions like these...13.2 Million haha nice try but I know in Canada there is only "caribous" and canadians. It is impossible to answer this question, and I will tell you why. On a daily basis, cows are being slaughtered and calves being born. Even if you asked me, How many cows were there on April 24th, 2013, at 3:47 p.m., there are still 60 seconds of time to consider, and faulty records from the farmers themselves. Now, on the other hand, if you asked me, "How many Canadian cows are named "Daisy", I would tell you there are 1,427. Then I would keep staring at your eyes until you blink. I love humor, and it makes life manageable. I just won't work for someone whose IQ matches that of Beavis and Butthead. If you tell how many grasses are there in America then i can exactly tell how many cows are there no of cows in canada are "no of cows in canada at thin moment"not or less by one. Possibly less than is needed, and probably not more than is wanted. Cows are not an invasive species. Over 1 moollion? It's like an eventual consistency problem in a distributed database. Every source will have a different number, and the real number fluctuates by the minute just from the millions of hamburgers that are produced daily in Canada. So, considering how accurate a number you need, and what point in time you need it for, you can aggregate data from many sources such as agricultural statistics, market prices, and futures prices and build a model, maybe using Bayesian Analysis, that will give you an estimate within a probability interval that is sufficient for your needs. Zero Quite a few I imagine, why? Show More Responses My initial guess is 4. But I'm not afraid to admit it when I'm wrong. 5 billion Submitting an answer 1 Uncounted I have bigger questions than this. 42 Probably less than there were yesterday I want Don't know Show More Responses 13.2M Cow In Canada According To WolframAlpha .... Vote 100 ~ So I Was Drunk Last Night I Got My Cat Put It In My Pillow And I Was Throwing Around Saying Its A Pillow Its A Pet Its A Pillow Pet XD... 13,200,000+ Cows In Canada According To The Internet ..... A lot six cows I will first state my assumptions. I assume there are 5 million cows in Canada. Then there are 5 million cows in Canada. Q.E.D. Hello, Thank you for sharing your interview experience. As a small team of ex-Google employees, we have recently launched a new website, interviewjoy.com, where you can earn money by sharing your interview experiences/insights with other job candidates. (It is a marketplace for sharing job interview insights). Posting an interview consultancy service is totally free & anonymous and we are giving 50 USD sign-up bonus for the first 500 users. You are kindly invited to interviewjoy.com to check it out. Users already started making money on the website! Best Regards.. (For more information: onboarding@interviewjoy.com) There is at least 1 cow and more... at every second possible. "including yourself ?" |

25 horses, 5 race tracks. How many races you have to run to select top 5 horses. 58 Answers7 Races First race all 25 in groups for 5 to figure out top 3 in each group. (15 left) Call them A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 Here A1 is faster than A2. A2 is faster than A3. The same applies for the rest of the groups. Now race A1, B1 C1 D1 E1 Lets say the order of the horses according to ranking was A1, B1,C1,D1,E1 So A1 is No 1 Now A1 is faster than B1 and B1 is faster than C1. So we can get rid of the entire D and E groups 9 horses remaining Also A1 is faster than B1 and B1 is faster than C1. So we can get rid of C2 and C3 7 horses remaining A1 is faster than B1. B1 is faster than B2. get rid of B3 6 horses remaining Out of these, We know A1 is the fastest. So now race A2, A3, B1,B2,C1 to figure out No2 and No3 positions One race is the answer Why 1? Show More Responses because, the top 5 are the fastest right ? so you run one race and take the best five times. It's a trick question to see if you'll make a mountain out of a mole hill. The first question to ask to clarify is: how many horses can fit in one track? Technically, one track can be used for all 25 horses, but this is too crowded for an efficient race. Let's say track size is not a factor, then, you need 1 race. Without overcomplicating things - the answer is 1 race. All other answers are based on dissecting the problem into, imo, unnecessary details. There is no mention of the capacity of each race track or number of gates available etc. Even if there are less than 25 gates available at a track, I'd say fetch enough number of gates so you can find the outcome with single race. This isn't a trick question. Normally this question has a track limit of 5 horses. I agree with Anuradha's answer. Anuradha's solution still has problems. (Even if we go with Anuradha's assumptions that you can only race one horse per track, and also assuming that we don't have a stopwatch and must compare horses placing positions) What if the fastest five horses are A1, B1, C1, D1, and E1 ? In Anuradha's second step, he elminates two of the fastest horses (D1 and E1) . He's assuming that A2, B2, or some of the other horses from the other heats are faster, but he hasn't actually tested to see if that is true. @anuradha: I think there are 2 problems: 1. How do you know A4 is not faster than B1 .... Suppose A1,A2,A3,A4,A5 are the fastest. 2. Using the logic posted we can get the answer in 6 races, 5 races for finding A1,B1,C1,D1,E1 and 1 race to find the ranking. Assuming 1 track for 1 horse then it need 5 races to select top 5 horses. Each race for 5 horses and count the time for each race. The top 5 fastest horses are the top 5 horses. 2 max: top 4 from first race, if 5th is a tie, then two, or else just one. 5 6 Show More Responses You guys are not doing CS! 10 runs is my answer. 1. randomize 5 groups, each of 5 horses 2. rank them within each group, I will use Anuradha's notation (5 races) 3. pick the best of each group, race to figure the 1st place, call it A1 (1 race) It should be clear, it wins all times, every one lost once. 4. remove it. substitute 2nd best in. repeat 3 (in my eg. A2,B1,C1,D1,E1) now you have second place. keep going, you get the first 5 and ranking! So, 5+5=10 races in total. The answer is 9. Assuming: - There's no time measuring (stopwatch), just relative places. - The horses perform consistently. - A maximum of 5 horses per race. First we need 5 races (A to E) to get relative scores for all 25 horses. Let's take a worst scenario: the list was already ordered (A1 fastest and E5 slowest), so race A contained the top 5. The 6th race would be the winners of the 5 races (A1, B1, C1, D1, E1), and would give A1 as the fastest of all. This would also mean that some horses can be excluded (only 4 more places to fill): B5 C4, C5 D3, D4, D5 E2, E3, E4, E5 For the 7th race, A2 would replace A1, and A2 would be appointed as the runner-up (of all). We also can exclude some more (only 3 more places to fill): B4 C3 D2 E1 For the 8th race, A3 would replace A2, but as E1 has been excluded, we got a vacancy. Let's add C2 for worst case scenario. The winner would be A3, and we can exclude more horses (only 2 more places to fill): B3 C2 D1 At this point there're only 5 horses who have not yet been classified or excluded, so the winner and runner-up of the 9th race would give 4th and 5th overall. To Patrick: I had to slightly modify your almost correct solution and got 10 races. You has an excellent idea to remove subset of candidates after final selection of the i-th horse, and my modifications are not an essential ones. Actually it is necessary to fix two small things: 1. get rid off the suggestion about the ordered list To avoid this suggestion I would rename groups from the fastest A to the slowest E with order by 1st horse after final selection of the i-th horse. So after race #6 we have order: A1, B1, C1, D1, E1, but there is no suggestion that all A are better than all B and so on. And after every race #7, #8, #9 we have to rename groups. With this modification your method works fine until final selection of horse #5 2. Without this suggestion you need race #10 to find the last 5th horse. To test both methods you may use 25 randomly selected integers and select the 5 minimal or maximum ones. I can't prove that 10 is the minimum number of required tests, but it looks very convincing. Thank you. Maybe Ziqi Dai also meant the same method, but it was difficult to understand without a couple of details. To Leo, I checked some random sequences with a spreadsheet, and all the remaining (not placed or excluded) horses run in the 9th race, so there's no need for a 10th race. Sometimes there're only 4 or even 3 horses left in the 9th race. I didn't check every possibility, but there was no indication a 10th was ever necessary. This answer is 1 regardless of track. If it can fit all 25 then you only need one race. If you make the assumption that only 5 can race at a time then you put 5 on each track and start the race on each track at the same time. Either way, the fastest 5 horses win. Using complex math on this is pointless since a pragmatic approach is available. @ Anuradha -- this is a great solution to the wrong problem! The classic problem is to find the THREE fastest, and that's what your solution is. However, the question posed in this thread is (likely incorrectly quoted from the interview) to find the FIVE fastest of the group. why would you make an assumption that makes this more difficult? I mean given this is an IQ test of sorts, making it harder than stated is........ Attention to details, Anuradha! You're answer would've been correct had the question asked for top 3 horses. This is like merge sort. In the first 5 races (when we run 5 horses per race) we get 5 sorted sublists. Each sub-list contains 5 horses sorted by their relative speeds within that sub-list. Now just merge these 5 sorted sublists to get your answer. Every "merge" means 1 race to find the fastest horse from the front of these 5 sorted sublists. To summarize: 1. Creating 5 sorted sublists of 5 horses each = 5 races 2. Getting fastest horse = 1st round of merge = 1 race 3. Getting second horse = 2nd round of merge = 1 more race 4. and so on... Show More Responses Why is this harder than having five races with five horses, recording the times of each horse, and sorting the list of observed values to get the top 3? it is seven race 7 full explanation; http://www.programmerinterview.com/index.php/puzzles/25-horses-3-fastest-5-races-puzzle/ 1 For 3 fastest horses no doubt the answer is 7 but for 5 fastest I worked it out to be 9. And pretty sure too 1 only if you can do good flow control and horse will start with different time / space out based on best estimate. It is kind of feeding the horse to the gate. Simply 5 races only, i.e. 5 horses in 5 race tracks per race. Finally, select top 5 horses by best fastest timing at finish line after 5 races. As a BA, the answer I would give is: We don't yet have enough information to provide a solution. There is critical information missing that could affect the solution. And flushing out all the critical factors of the problem are one of the most important responsibilities of the BA. As a BA, it is very important to NOT start building solutions to problems that you don't yet fully understand. Actually, it's one of the biggest mistakes inexperienced BAs make: solving the wrong problem because they rushed to solutions and did not fully investigate and understand the problem! Once they're committed to the wrong problem, they end up with a beautifully done inadequate solution. 5 races, because you can fit 5 horses in 1 race and there are 25 horses. You just note the timings of each horse and compare them after all the races are done. That way, you won't have to arrange more than 5 races and stopwatch is a common tool for every phone!!! First of all guys, you guys are making critical mistakes. You assume we have a timer but that would make it too easy, right? I'm just assuming that 5 horses a track and no timer. So I have two potential solutions: 1. You could always just race them all at the same time on 5 tracks...but that'll be too easy. Then there's my solution: --------------------------------------- First, group all the horses into five groups of five. It doesn't matter which horse goes into which group, it honestly doesn't matter. Then, race all the horse in one groups against each other. It helps to name them A-E(Group name) and the number place they came in (ex: 1st place a group would be A1). So now we have A1 to A5 and B1 to B5 and so on until E5. Then race all the 1s against each other. You should get something like A1, C1, B1, E1, D1 and then you should arrange their groups in collumns from left to right based on that race (1st on left, 5th on right). Here is where it starts getting complicated, so I will just assume it is A1 fastest in that race and E1 slowest and so on just for simplicity. So so far this is 6 races. Get E1 and race them against D2-5. You can ignore E2-5 because no matter what they can never be in the top 5 because A1, B1, C1, and D1 is the fastest of their groups and you know that the fastest five can come from those groups but not E2-5 because E1 is the slowest of the 1's and there's no way those horses can be in the top five. SO just throw them away. Since there are four spots available max you race the slowest four of the D which happens to be D2-5. Get the place numbers and arrange them. EX: D1 D2 E1 D3 D4 --- D5 E1 can be anywhere based on E1's speed but you immediately want to discard the D5. You might be saying, "Hey, why can't we discard anything below D2 since A1 and B1 and C1 are all faster than D1 and E1?" But...you could be unlucky and have A2-5 and B2-5 and C2-5 be all dirt slow. So just keep them for now. So the rule now is to keep all the horses that are in the top 5 and discard the rest until you get to A, when you know, "Oh, A1 has to be the fastest horse." 7 races. So we have our list above just for examples. Next you want to race D4 against C5 to see if our group can EVEN pass the C's, cause we might get super unlucky and see that C1-5 is faster than D1...if D4 loses in 5th place we just throw this all away and our new list becomes: C1 C2 C3 C4 C5 But otherwise we'll just assume that our D4 luckily got to 3rd place. It becomes: C1 - Our group can go anywhere inside the lines so race them again C2 minus D4 since its in 3rd place to see where they go. Let's assume we got SUPER lucky and C2 became last place in that race. - C3 C4 C5 8 races. We raced this group at that time and left out D4 because D4's fate was already decided: D1 D2 E1 D3 C2 It turnes into this: C1 - D1 D2 The single dash indicates where our new group was spliced, ofc the triple E1 dash lines show where the cutoff is, so discard everything under the line. D3 -(---) C2 D4 C5 9 races. Kay, so now we have the five fastest in the E, D, and C groups. Now continue with the B groups and let's say that our D3 passed B4 only... It becomes: B1 B2 - With our top five so far group racing against B4 B3 - D3 B4 B5 10 races. And then with another race you get this with lets say...only our top two making it through with B3 getting ironically first place: B1 B2 B3 C1 D1 --- D2 E1 Yep...E1 got kicked out. Aw well. SO NOW our to group D3 is the group above the triple dash marks. B4 B5 11 races. Now we're up against the A group. Assume that they are all wusses and that our D2 beat all of them except for A1. So we got lucky and the new lineup is this: A1 B1 B2 B3 C1 --- It was inevitable that A1 would become first but now this is how you do it! D1 D2 A2 A3 A4 A5 12 races/13 if our B1 didn't beat all of the other A's on the first try. Conclusion: 5 races (initial races)+1 race(for initial group leader ranking)+1 races(E-->D)+2 races(D-->C)+2 races(C-->B)+2 races(B-->A) =13 races/10 races if you get insanely lucky and have all our previous groups beat all the #2s of the groups. Show More Responses Oh nvm ignore that it was all crushed into one place with no spaces...I'll stick a better one later. The answer is 8 races assuming that you can fit only one horse on one track. Divide the group into 5 horses. In five races we can find the 5 fastest horses in the 5 groups. The 6th race is among the top 5 fastest horses. The top three fastest horses in the 6th race are faster than the horses in the group of the 4th and the 5th fastest horse. The horse that came third in the 6th race may or may not be faster that the horses in the group of the fastest and the send fastest horse. To determine that, we hold 2 more races. So 6+2 = 8 races is what I think is the correct answer ****************ANSWER -- 3 RACES.************* Given : 25 horses, 5 tracks Assuming : 5 horses to a track Five groups of 5 horses for each track (5 tracks, tracks ABCDE, each track with horses labeled "X#") First race allows you to find out the top 5 horses (however this isnt the true top 5) [A1,B1,C1,D1,E1] Second race the top horse is discovered (lets say its A1) Now you have to find out if B1 is better than A2, B2 is better than C1, etc. (each predecessor of each winner) We know that B1 is better than [(CDE)1] Third race we have A2,B1,B2,C1,D1 Conclusion : If both of the predecessors are NOT last place, then we have our answer at race 3 by taking the top 4 to be the bottom 4 of the top 5. Otherwise, repeat this process one more time to find the 5th placed horse. Ans is 14 Patrick gets the right number but his logic is not the most efficient. Initially follow the standard procedure and race 5 groups of 5 (races 1-5) and then race the winners (race 6). The winner is the fastest overall. Now name the groups with the horses in the winners group A1,A2,A3,A4,A5, the first four horses in the runner-ups group B2,B3,B4,B5, the first three horses in the third group C3, C4, C5 down to E5 for the winning horse from the slowest group. The numbers indicate the highest possible position a horse could attain (i.e. C4 is definitely slower than C3, B2 and A1 but may be slower than several others). The rest of the horses are eliminated and so don't need to be labeled. Now race (race 7) the horses labeled 2 or 3 (there are 5 - A2,A3, B2, B3, C3) The top two are second and third overall and the loser is eliminated. You can eliminate a total of 5 or 6 horses - those known to be slower than the fourth or fifth place finisher and any two positions slower than the third place finisher in race 7. There aren't that many options here so you can just inventory all the possibilities if you wish. At this point you have a maximum of 7 horses for the remaining two positions You just race any 5 (race 8) to eliminate at least 3 and race the rest (race 9) to get the fourth and fifth fastest overall. If you choose all the potential fourth place finishers in race you may not need race 9. As noted elsewhere Anuradha gets the right answer to a different question than the one asked. I have stepped among a lot of smart folks here. Maybe even several analyst's. So here it goes. I am looking at this as who the question is coming from and for what. A Business Operations Analyst for Google. Everyone is so focused on answering the question based on assumptions. Ie. That every horse and rider are at their best condition and that every track is exactly the same. That you are running all the races in the same day and that horses, riders, and tracks dont change. Horses and riders get tired, not to mention the possibility of injuries, and track conditions can change so forth and so on. So to me. In order to (analyze) to get the best possible answer. I would start by asking questions and not assuming. The more information you have leads to the best possible answer. Guys think as a programmer, (mind my language and grammar) algorithm would be of these steps ->group the horses (5 horses each) -> get the best runner of each group (five races) -> store the horses in winning orders to five stacks (a,b,c,d,e) ->until the top 5 are found, repeat ->race all the 5 on top of the stack ->pop the winner from its stack and store in top five that all, now lets see how it will work. lets have 5 horses per group and group them as a,b,c,d,e. 1=a1 a2 a3 a4 a5 a1 (winner) 2=b1 b2 b3 b4 b5 b1 3=c1 c2 c3 c4 c5 c1 4=d1 d2 d3 d4 d5 d1 5=e1 e2 e3 e4 e5 e1 now we have best of each group, let them race 6=a1 b1 c1 d1 e1 a1 for every winner get the best candidate for the group, and race again, until top 5 are found 7=a2 b1 c1 d1 e1 a2 8=a3 b1 c1 d1 e1 a3 9=a4 b1 c1 d1 e1 a4 10.a5 b1 c1 d1 e1 a5 for any scenario just get the so the ten races. its like finding five highest numbers from 25 numbers, when you can only compare 5 at a time. Answer- 7 Races Give names H1....H25 Divide into 5 groups as 5 can run at a time H1, H6 , H11, H16, H21 are fastest in there groups Now we can remove last two from each groups as we need fastest 3 now we left with 15 horses 6th Race- between all fastest in groups After 6th Race H1> H6 > H11> H16,>H21 Now H21 was fastest in group but is 5th in 6th race so H22 and H23 who already slower than H21 can't be in first 3 Same thing applied for H17 and H18 as H16 was fastest in group race but 4th in 6th race Same applied for H12 and H13 as H11 was fastest in group race but 3rd in 6th race Already three horses are faster than H16 and H21 so they both also can be rules out Now we left with H1, H2, H3,H6, H7, H8 and H11 But H8 is slower than H7 and H7 is slower than H6 in group race and we have H1 on top already so H8 also can't be in fastest 3 Now we left with H1, H2, H3,H6, H7, H11 H1 we know is fastest..so lets 7th race between H2, H3, H6, H7 and H11 and find the other two After 7th race you will get fastest 3 Make a group of 5 horses per track and race them all at once. The winners of each track totals to "the top 5" ! The answer is 7. Assuming: - There's no time measuring (stopwatch), just relative places. - The horses perform consistently. - A maximum of 5 horses per race. Race r1: A1 A2 A3 A4 A5 (By order of winners) Race r2: B1 B2 B3 B4 B5 Race r3: C1 C2 C3 C4 C5 Race r4: D1 D2 D3 D4 D5 Race r5: E1 E2 E3 E4 E5 Race r6: A1 B1 C1 D1 E1 (rename R1 R2 R3 R4 R5) Here comes the tricky race. From race 6, we already know the ranks. As a demonstration, assume R1 = A1, R2 = B1, R3 = C1, R4 = D1, R5 = E1. Then: 1) D1 D2 D3 D4 D5, E1 E2 E3 E4 E5 are out of the contest. Because D1 and E1 are ranked 4th and 5th in a race. 2) C2 C3 C4 C5 are out of the contest. Because two horses already are faster than C1 ==> 3 horses are already faster than C2 C3 C4 C5. 3) B3 B4 B5 are out of the contest. Because one horse already faster than B1 ==> 3 horses already faster than B3 B4 B5. Remaining potential horses are: A1 A2 A3 B1 B2 C1. Here, A1 is redundant because we already know it is fastest. Race 7: A2 A3 B1 B2 C1. The top 2 will be added to A1 to be the fastest three. Show More Responses Take a look at previous horse race statistics from horse newspapers. Make your analytic and you have your top 5 horses without any new race :) It will take min 9 race not 7: first five race and find top 3 @ every slot now total race=5; one race between first five, now we find top 3 and take 2nd and 3rd from the race as 1st is declared. race=1; 1 race between 2nd finisher of all slot and take 2 from them , race=1; 1 race between 3rd finisher of all slot and take top finisher, race=1; now we have race between 5 horses(2+2+1) and find 2nd and 3rd; so total no of races= 5+1+1+1+1=9 ; I have grouped them in 5 groups. See the groups below. I have also ranked them in the order of the wins. So for e.g. in the first group, 1st horse came first, 2nd horse came second and so on In the second group 6th horse came first, 7th horse came second and so on. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 After the first five races, there will be two more races So the sixth race will be among the horses below (who were first in the previous races) and I have ranked them in the same order in the 6th race 1 6 11 16 21 - - So 1st horse came first, 6th horse came second and so on. Now for the 7th race, we will take the winner of the 5th race and make him compete against the first four winners of the 6 the race. So it will be something like this and I ranked them in the same order for the 7th race. 1 6 11 16 26 - So from 7 races it will is very clear that the fastest four horses are 1 6 11 16. Now, only 21 and 26 are the contenders for the fifth position, based on their timings in their respective races (6th and 7th ones), we can decide which one is faster between the two. So in total , we would need 7 races. The question is not a good one! Let those horses be marked X1~X25. First divide them into 5 groups X1~X5, X6~X10, .... Assume the first X1, X6, X11, X16, X21 are the fast ones in each group after the first round. Also, X2 > X3, X6>X7, during the first round. We then, during the 2nd round, form the first group with those fastest from each group in the first round. Assuming that X1 > X6 > X11 > X16 > X21 after the first try of the 2nd round, we will then have X2, X3, X6, X7, X11 to form a new group and determine which are fastest 2 in this new group. Nevertheless, during the 2nd try of 2nd round, it can happen that X3 > X2 or X11 > X6. The inference fails all the relation set in the previous try. ( that the X2 > X3 ,after the first round, and X6 > X11, after the first try of 2nd round). It would be better to change all those horses to be boxes carrying different integer value. You want to sort those boxes to find which carrying the largest 3 numbers and, at any time, you can only open 5 boxes to inspect . You cannot mark the content of boxes but you can put down the relation between boxes during the inspection. Then, the number of inspections needed to find boxes with the largest 3 number will be 7# This seems like a simple answer, but I'm pretty sure it's 9. Race 5 groups of 5, then race all the 3rd place, then the winning 3rd races the seconds, then you have either have five firsts and two seconds left or 5 firsts a second and a third left from the original racing groups. Worst case scenario you have one more race of three ones and two twos or two ones and the 2nd and third place to find the fastest there out of that last group. 9 races. So driving down the road I figured out I should have started from the top after the first five races. Then worst case scenario you run three more races to find out the top three. 11111, 21111, 31111. Damn. Six races, six groups. First group will have five horses, the 5 others groups will have only 4 horses. The winner of the first group of 5 horses will pass to the second race, then the winner of the second race will pass to the third race and so on, bay the end of the 6 race you will have top 5 horses. 25 horses, 5 race tracks. How many races you have to run to select top 5 horses. Solution: http://codinginterviewquestionsans.blogspot.in/2017/07/25-horses-5-tracks-5-fastest-horses.html Step 1: First, we group the horses into groups of 5 and race each group in the race course. This gives us 5 races. W11 W12 W13 W14 W15 W21 W22 W23 W24 W25 W31 W32 W33 W34 W35 W41 W42 W43 W44 W45 W51 W52 W53 W54 W55 Step 2:we race the 5 level 1 winners(w11,w21,w31,w41,w51) and assume winning order of this race is w11,w21,w31,w41,w51 (THIS IS 6TH RACE) Step 3: BECAUSE WE NEED TOP 5 AND W51 HAS COME 5TH Position that is the reason we don't need to consider W52 W53 W54 W55 now we have W11 W12 W13 W14 W15 W21 W22 W23 W24 W25 W31 W32 W33 W34 W35 W41 W42 W43 W44 W45 W51 Step 4: because we need top 5 then dont need W25 W34 W35 W43 W44 W45 now we have W11 W12 W13 W14 W15 W21 W22 W23 W24 W31 W32 W33 W41 W42 W51 Step 5: top 1 is already achieved which is W11(winner of 6th race) remaining are X W12 W13 W14 W15 W21 W22 W23 W24 W31 W32 W33 W41 W42 W51 Step 6: candidates for 5th position: W51 W42 W33 W24 W15. 1 RACE TO GET 5TH POSITION (this is 7th race) remaining are X W12 W13 W14 W21 W22 W23 W31 W32 W41 Step 7: candidates for 4th position: W41 W32 W23 W14. 1 race to get 4th position ((this is 8th race) X W12 W13 W21 W22 W31 Step 8: candidates for 2nd and 3rd position: W12 W13 W21 W22 W31. 1 race to get 2nd and 3rd position ((this is 9th race) Hence answer is 9 races. Assuming no limit to how many horses on a track, 1, because the fastest 5 will obviously finish in 1st, second, third, fourth, and fifth place. If there is a limit to the number of horses on a track, then it will take (25/number of horses to a track) rounded up to the next integer races because you can just compare the times of all of the horses and pick out the five fastest times. There are a lot of wrong answers on here or answers for different questions. Answer for top 5 is 8 races. You can find explanations online for this. Show More Responses Friends only 5 races are required As mentioned we have 5 tracks and 25 horses. So divide them into set of 5 And winner of each set is fastest so only 5 races are required. 18 If there in no limit on track one race is enough. But if 5 horses can run at a time we need 6 races. 5 races to find top of each group. And additional 1 race among those top 5 horses to find out top 3. answer is 8 suppose we have limit of 5 horses per track and all horses run together on 5 track so *-5 races-* conducting on five track, the top one of each track is selected for further race and now race is conducting between the all top 5 horses which is *-6th race-* and the remaining 4 horses will race again for 2nd and 3rd position hence total no. of race are 5(all five races)+1(6th race)+1(7th race)+1(8th race). So many wrong answers here, first of all the question is about FIVE fastest horses, not three, so all the posts giving 7 as an answer are wrong. All the answers above 9 are also wrong. You need 7 races to find 3 fastest horses, after that by using logic you come down to either 6 or 7 remaining horses as candidates for places 4-5, and you need 2 races to figure out which 2 of them are the fastest. So it's 9 races in total. |

### Vendor Relations Manager at Google was asked...

How many people using facebook in San Francisco at 2:30pm on a Friday? 50 AnswersDepends which year, particularly if you are asking about any Friday prior to 2005, for example. In general, the question is unanswerable, since anyone using the internet, in any application whatsoever, is "using" Facebook, which also contributes data and information to the internet. If you are striving to determine how many people are actually "on" FB at 2:30pm on a Friday, I would venture a guess that perhaps 10% of the population is actually on-line on FB at that time. Interesting question, but the parameters are rather indeterminate. About 60 percent of adults (18+) Americans have a Facebook account. But we're talking San Francisco here--the Valhalla of Nerdery and all things internet--so lets bump that up to 80 percent (this 30 percent increase is justified by the fact that SF is 30 percent geekier than anywhere else...). For purposes of the question, let's limit this explicitly to the city of San Francisco--not the entire Bay Area. At night, SF is about 800,000 people strong. Let's assume a little over 20 percent of that population is either too old or young to use Facebook (it would be higher if mothers hadn't taken off FB...). Let's say that leaves 600,000 people (note: working with round numbers is better for these sorts of things). But then we have to take into account the fact people commute to and from SF! Nerds pour out into the South Bay, suits (e.g., bankers) come in from the East. I suspect the city population swells by 50 percent. If we toss in tourists and conference goers and everything else, 1 million people are in San Francisco at 2:30pm on a Friday. Eighty percent of those people use Facebook, so we have 800,000 possible Facebook users at that time. The final step is to figure out what percent of the 800,000 are using Facebook at 2:30pm. It's later in the day so I suspect it will be higher than at 11:00am. But I don't really have a good baseline to judge. When I walk around my office, roughly 10 to 20 percent of screens I see as around the office are on some non-work related thing at any time. Let's call that 15 percent and assume that all non-work related surfing by FB users includes some sort of use of FB. That means 120,000 people are using FB at 2:30pm on Friday in San Francisco. This is good feedback, but i'd also be curious to know why Facebook and not Google +? Show More Responses "How many people on facebook...." 4, 573, 210. Prove me wrong. To Barney, the population of SF is only about 800,000. All of them. Facebook's corporate HQ is in Menlo Park, a suburb of San Francisco. So, anyone using Facebook is using "Facebook in San Francisco". Let me google that for you. If the answer isn't readily available, I'll E-mail someone at facebook analytics. No one will surmise a closer answer. Let's Ask Jeeves. Answer?... more than are using Google+ I think that there can only be one motive behind asking such a stupendous question, i.e., to see your thought process, and to see your assumptions behind your guesses, how deeply did you think about the problem, how many dimensions did you look at, before formulating a 'plan'? Such questions are best tackled by doing a quick internal-brainstorm session while thinking aloud~so that your interviewer also gets a glimpse of your inner-mind's working. In this respect, i think that GBAD has done a good job of making his/her assumptions clearer than the rest of us. Too many. Aditya is correct, although fascinating how many ppl show their lack of problem solving, including GBAD. Extra bonus points for Tim's answer, because he probably answered the question that created the question in real life. "The final step is to figure out what percent of the 800,000 are using Facebook at 2:30pm" Actually no, you already said that was the night population of SF, so therefore you're basis is way off. Many more people work in SF during the day than live at night, so toss the 800k figure out to start. And Daniel Gullo, decent answer, but the question didn't ask what percentage of users were in SF. That's what you answered. So... let's see. I'd guess there to be around 1.5m people in SF on a random Friday @ 2:30, maybe 10% of which are actually on FB. Easy as pie answer of 150,000. Correct or not, the logic is strong, and that's the point. God, Is that really strong logic? Where did you get the 10%? I would think that at 2:30 on a Friday more than 10% of the working population have Friday-itis and are surfing facebook to plan their weekend Show More Responses A; Who cares I'm not one of them! I'm still at work! The answer is-- The number of people on Facebook in SF minus the number of people not using Facebook at 2:30 that Friday @God, Daniel answered the question in a clever way, but somehow you missed it, despite your all-seeing nature. He simply read the question with a different emphasis: How many people using *facebook in San Francisco* at 2:30pm on a Friday? rather than *How many people using facebook* in San Francisco at 2:30pm on a Friday? I would have been inclined to ask a "qualifying question" - What problem are you trying to solve? If as I suspect Tim's presumption is correct, perhaps the interviewer would have admitted it and then you could offer your expertise in correcting that condition. there is no right or wrong way to approach the answer to this question. There is also no right or wrong answer. They only want to see what logic you are using to come up with the number. It is a similar question that I believ Microsoft, it could be Google though, asks when asking how much would you charge to wash all the windows in Seattle. you can multiple and divide and subtract and add the population by the work force, avg height of the building, and come up with a number, or yo can simly say 10 bucks a window. I compare these oddball questions to the Men in Black Scene where J is trying out against the "best of the best"......these companies are trying to find the out of the box thinkers. Many seem to use their education, assumptions, statistics, logic, and deduction to come up with the answers. Answering the question is the first mistake most interviewee's are making. I think these big companies would probably hire Tim first over GBAD. Why Tims? There's no way Google could argue nor find flaw in that statement. They know where Google+ stands, and they can't disprove that as false. Whereas GBAD, they'll probably start questioning him on where he came up with the stats. It's not about the right answers, it's about how they can prove you wrong. So don't let them prove you wrong. More than the amount of people who know about Google Wave. @AL: you're right to point out that these questions can be used to assess creativity. but more often than not, when asked by a big company like google or any of the consultancies, they want an answer. they want to see how you make assumptions--even if the final number if way off. if you can sprinkle in some creative bits, that helps. but you typically need a number at the end. All of them. Meaning people. Who else would be accessing Facebook in the first place, a dog, cat, squirrel? It's like the question asked when passing a cemetery...How many people are buried there?...Silly fools. All of them. LOL. All of them. Melissa is right, oldest most logical answer out there. Show More Responses Will go with Melissa on this as most people are offering answers to the question "How many people are using facebook" instead of "How many people using facebook". Simply put many people. Are we talking about people that live in SF as well as people born there that live elsewhere? Is this including people on planes travelling elsewhere on facebook? For how long does the user have to be on facebook to be included? 2 guards......one holds the door to life and freedom, the other death. You can ask one question to one guard. What question do you ask? Well, Siri didn't know. Me: None Interviewer: How could you ever know that? Me: San Francisco is far too techsavy to use such an outdated technology, they're on google+ GBAD's approach is correct. This type of interview question is referred to as a brain teaser. Most of the large management consulting firms throw these types of questions at you, along with business cases that require you to compute numbers and rationalize your way to a solution. The interviewer is not interested in the answer you come up with here. He is interested in the thought process and your analytical problem-solving skills used to find an answer. A similar question used is: "How many ping pong balls would fit in the body of a Boeing 777?" Yet another: "How many boxes of Count Chocula cereal were sold in the United States last year?" They don't want you to respond by saying you'd look at the sales figures from General Mills. They want you to come up with something on your own. They want to see your methodology. These types of questions separate the best from the best. If you'd like more information on these types of interviews, Google "McKinsey consulting interview questions." ANS: I don't know. May be if facebook uses google analytics, then that can help! I would ask in return, Can you tell me a little bit about how the answer will be utiliized . Data is data but depending upon how it will be used, depends on the answer. Turn it around for just long enough to allow the interviewer a chance to show off while you come up with a valid answer. And because you will not have your computer available use the above advice and give a generic answer about how you would progress to acquire this information. Certainly they most probably do not care what the technical answer is, they want to knowcan you process problems and create solutions. equal to the no. of gmail users.... This is where you show off your technique rather than your memorized set of facts. The interviewer is interested in your powers of deduction as well as your prowess in planning an estimate. First of all, it is necessary to define the term "using". Possible definitions include: have an active session with; exchanging data with; displaying the website in some viewer; etc. Someone having the right kind of network access, assuming you could contact her, would be able to count the number of active sessions, but this would return a count of endpoints rather than of "people". Further refinement necessary. Given the number of variables and the uncertainty in each, the crucial part of the answer will be to pin down a confidence interval. After reading though the list of questions and answers I offered the following observation on the Tesla question and am repeating it here on the first question: These questions (all 25) on the most part seem to be using the psychological projective test technique. In projective tests the questions are designed to be ambiguous. It's like looking at an inkblot and telling me what you see. Because it's random with no clear answer, you have no choice but to “project” your personality, thoughts and feelings in the answer. Thus revealing something about yourself that the interviewer may find useful and hopefully job related. For example, those of you who obsess over the technical details or those of you who offer a glib response or those of you who ask why is the question relevant. These answers all attest to an aspect of your personality. That said, while I like the idea of projective tests I suspect that these questions are mostly amateurish attempts at projective tests that have not been validated or shown to be job related- I would be surprised (if not heartened) if otherwise. Show More Responses hold on... let me google it from my android phone... Thanks GBAD and MM. I am actually preparing myself for a consulting position and have done tons of preparations. That is the way such a question should be approached. As MM mentioned the interviewer is "interested in the thought process and your analytical problem-solving skills''. It is not a tricky question, and at the end, they want a NUMBER. MM has provided the most in depth analysis. Paul's answer is amazing....as an ice-breaker, than...comes GBAD's. Correction: GBAD has provided the best analysis. Florin - Remember that people hire people that they feel reinforce their values and sensibilities. In the consulting field they call this mirroring - you mirror the values, etc., of the client. Mirroring works great for client engagements. They may be assessing your fit with the company with a the "brain teaser" but I find it unlikely that all they are interested in is you cold analytical abilities in figuring out an absurd question. Analysis may be part of the puzzle but it will also be in how you respond to them as people, how you make your argumment - in short - are you one of them and will you fit? The moral to this whole story will be simple and is something you've known all along (your mom and dad probably told you this) , be yourself. If you don't fit, the job will not work out for you in the long run anyway for a lot or reasons including because you won't be happy there because, well, you don't fit. So be yourself and be CONFIDENT in who you are. If the fit is there you've hit a homerun. If not, it's just a job. At that point I would ask if anybody with half a brain would like to talk to me or should I just leave? what's facebook ? ;) Seems like a Fermi question isn't it? http://en.wikipedia.org/wiki/Fermi_problem The answer should revolve around the actual position your are applying for. For instance, TNT's response to qualify the question would be a great answer for a sales position. GBAD a statistician or someone involved in marketing research. Always answer a question in which is applicable to the job. THERE IS NO CORRECT ANSWER. However I did think whoever said "everyone, because facebooks headquarters is in San Francisco" is a clever enough answer for any position. I will also say that ultimately the idea is to see how you handle the question, which is applicable in any position. If you don't answer with confidence, no matter what you think, I wouldn't be excited to hire you. Its questions like these force me to be self-employed. I have a low tolerance for mind games. I would answer this question with a statement. I don't know the answer. Can you tell me why this information is important to you and how it pertains to the position I am interviewing for? The I would wait for their answer, and respond to that. . Comparatively less than the people using google @ d same time (keeping in mind that the question was asked by google for the post of VENDOR RELATIONS MANAGER). Show More Responses Isn't the interview question incomplete or grammatically incorrect? Plus or Minus 10% that were using it at 2:29:59. Except on the Friday with the earthquake. If the interviewer asks which was that Friday then you tell him :"Please you answer that because I want to see the caliber of the people that I will work with assuming I will accept your offer." given its a friday and its already 2:30 pm.... ill say more people are using facebook than any other weekday as they will be planning the weekend with their friends. This is a question asked by Google. Clearly, they want you to Google the answer. None. They all should be using Google+ 1159 less than the people active on Whatsapp in San Francisco at 14:31 on a Wednesday. Hello, Thank you for sharing your interview experience. As a small team of ex-Google employees, we have recently launched a new website, interviewjoy.com, where you can earn money by sharing your interview experiences/insights with other job candidates. (It is a marketplace for sharing job interview insights). Posting an interview consultancy service is totally free & anonymous and we are giving 50 USD sign-up bonus for the first 500 users. You are kindly invited to interviewjoy.com to check it out. Users already started making money on the website! Best Regards.. (For more information: onboarding@interviewjoy.com) |

### ASIC Verification Engineer at Zoran was asked...

You have 2 pieces of rope, each of which burns from one end to the other in 30 minutes (no matter which end is lit). If different pieces touch, the flame will transfer from one to the other. You cannot assume any rope properties that were not stated. Given only 1 match, can you time 45 minutes? 49 AnswersTake one rope (Rope A), place it down as a circle. Light match and start burning rope A at the tips that are touching. When the rope completely burns out, 15 minutes will have passed (since both ends are burning and being consumed at once). Hold the second rope (Rope B) straight and place one end so that it will immediately catch fire when the two burning points from (Rope A) finally touch and are just about to burn out. Thus 15 minutes on Rope A + 30 minutes on Rope B gives you 45 mins. How about this: Fold the first rope double so the ends touch. Lay it down and lay the second rope so it touches the fold of the first rope. Light the ends of the first rope. After 15 minutes the second rope should ignite. Once second rope finishes burning it is 45 minutes. Same principle as above, I just don't want to sit there for 15 minutes in order to light the second rope.... :-) Make a T. Simple Show More Responses Light both ropes at the same time with the match: ------------* () *---------- || then place the two ropes next to each other with the burning ends opposite each other: this way one of the ropes burns left to right, while the other is burning right to left. ----------* *---------- In 15 min the two burning ends will be next to each other. -----* *----- Great Puzzle, thanks! ** You cannot assume any rope properties that were not stated Burn like this *-------- ===> After 30mins, Rope A finished burning, and both ends of Rope B start burning burn one rope, wait till it gets to the half way point, then you transfer the first one to the second one to initiate the other flame. wait till the end. 45 minutes are up You have 2 pieces of rope, each of which burns from one end to the other in 30 minutes (no matter which end is lit). If different pieces touch, the flame will transfer from one to the other at the point at which the burn rate consumes the first rope to its point of contact with the second rope. The only thing we know about the second rope is that it will burn in 30 minutes if ignited from one end. There is no assurance the second rope will ignite, or burn at the stated rate, if an end is not made to point of contact. do you want to buy saints jerseys,vikings jerseys? depends on what the ropes are made of @eaasy you can assume that the second rope with burn at the same rate if lit from the middle, as the rope burns a set amount of time from either end. If Point A to Point B is the same as Point B to Point A, igniting from the center would cause the flame to finishing burning Point A AND point B at the same time. As for ignition, you have a point. There is no assurance that the first rope does not have a prolonged burn rate at the ends and an accelerated burn rate in the center. Therefore the second rope could have ignited before the first rope finishing burning (at any point before the 30 minute limit) which would make timing 45 minutes improbable. Lay one down, and have the second one touch the first rope perpendicularly at the midpoint. Light the first one, when it gets to the midpoint (15 minutes), the second will start burning. When the second one extinguishing you have 45 minutes. T. Simple, quick, walk away and do 45 minutes' work where you can still see light from the flame. Both ends will finish burning at the same time if environmental conditions are consistent. LAY THE TWO ROPES WHERE THE SECOND ROPE IS TOUCHING ONE END TO THE MIDDLE OF THE FIRST ROPE. IT SHOULD TAKE 15 MINUTES TO START THE SECOND ROPE AND THEN ANOTHER 30 TO COMPLETLY FINISH BURNING SO THIS IS 15+30=45 Show More Responses lay ropes end to end, to make one long length, when first length ignites the end of the second length, touch the last remaining end to it and let the flames meet somewhere in the middle. That way each flame will travel in the correct direction, are considered to be burning end to end, without ambiguously being lighted in the middle and hoping the direction will be as desired.... since it takes 30 minutes end to end, then to ignite both ends of the second rope will draw a 15 minute interval no matter what the burn rate is per divided section, thank you and I will accept $150 K per year and 30 days vacation time yearly as well... I had no idea that rope burning was so lucrative a career field... and I want my own rest room. it all depends on what kind of match you have. They said you have one match (no book or box) so if it's not a strike anywhere match then you're screwed. However, if it is then make the T formation... The vertical rope burns 30m then the horizontal burns both directions for 15. No loops, circles or folding required :-) burn A at the two ends will give you 15 min, and when finish A, then burn B next. Lay the map in a T formation, light two ends of the horizontal rope with the match. when the flames meet in the middle in 15 minutes they will light the second rope which is perpendicular to (and touching) the first rope. That rope will take 30 minutes to burn. Hence, 15 plus 30 = 45 minutes. burn A at the two ends will give you 15 min, and when finish A, then burn B next burn one rope, wait till it gets to the half way point, then you transfer the first one to the second one to initiate the other flame. wait till the end. 45 minutes are up Helpful Answer? Yes | No Lay the two ropes in a "T" shape. Burn the one rope at the bottom end of the "T". It will take 30 mins for the flame to go through first rope, and when it reach the other end, transfering the flame onto the second rope right at the middle with the flame move towards both directions, taking 15 mins to completely burn out. This is a silly riddle.... because we're not given the property that the rope can bend, the best formation for the two ropes is to lay them in the "+" formation that everyone got. However, no one mentioned burning the rope at the intersection of the two ropes, ropes will burn in 15 minutes. Also, there isn't anything saying you can't light the ropes more than once with one match (assuming you have the ability to light the match, as someone already pointed out as a significant problem), in that case, you could burn the ropes up in less than a minute. If the rope can bend, just bundle the ropes up into a ball and light the rope ball on fire... it take 1.3 seconds to burn the ball if you create the most efficient weave... true story, I was there. But of course, if you wanted to make the most efficient use of your time (e.g., if you're lazy), you can just crumple the ropes up together, drop the heap of rope on the ground, and throw the lit match on the pile and be done with riddle (and the ropes... and the match). I agree with a couple people here. In this you cant assume the rope burns uniformly. Therefore loop one rope and put the end of the other so it touches where the ends meet. so you have this C--- light the straight rope, when it burns it'll light the "C" which will burn in half the stated time (15 mins). Just a quick one for all the "T" people, you're wrong... The rope doesn't burn uniformly so you can't measure to choose time. If you could you may as well just cut one of the ropes... Show More Responses Solution: NO YOU CANNOT GUARANTEE 45min. Most likely solution to work: Straight followed by loop. ---O One straight, followed by a loop. Ignite straight first, have it ignite the loop. You ignite the straight, gives you 30 minutes. Loop ignites, both ends may burn at different speeds, but when it finishes it will be 30mn/2. The flame may end anywhere on the loop, not necessarily at the 1/2 way of the rope. Why wouldn't it work: Above, you're assuming the rope burns end to end. If the rope is really non-uniformly burning, you can devise a case where burning on both sides at the same time doesn't make the burn 1/2 the time: For example, the outside burns real fast and the core real slow: no matter where you ignite it, or how many times, it would burn in 30mn. For that case, you could split the rope at their diameter and maybe rig a solution. But likely there can be another counter example that can be built, more and more far fetched. Interviewer will want you to explain the thoughts, non-uniform burn, etc. So this is an opening to check your deductive powers. What's the purpose of such a simple question? To judge how you react and explain yourself? Fold each rope in half & mark them in the middle. Light 1 rope & when it reaches the middle light the other one. When the 2nd rope burns completely you'll be at 45 minutes. no comment Too easy... fold one of the ropes in half end to end with the full rope... viola! There are a couple of answers. It depends how you would interpret the question. "the flame will transfer from one to the other" Assuming no special materials you would have on the ropes. This phrase can be interpreted that THERE CAN ONLY BE ONE FLAME. Thus the flame moves from one to the other and does not multiply i.e you can have more than one rope or section of the rope burning .(If it could the solution is easy-just arrange both ropes end to end into a pentagon shape or do what some people have suggested above). for the 45 mins thing you do the T shape like people above suggested so 15+30 =45. If you assume you HAVE to take 45 mins this is the best way. Assume that an earlier finish is best, the Pentagon would be fast. -When I mean pentagon I mean the 5 pointed star thing you know from the occult.- If there was only one flame which could transfer from one rope to the other without creating multiple flames you would have to ask how fast does the flame transfer and what distance does the flame burn at before being transferred. The reason for this is, if the ropes are lied down next to each other TOUCHING each other then the flame would burn, transfer, burn, transfer etc. this would take 30 mins assuming that there is no time lapse on the transfer(hence my questions above). If you wanted to hit the 45mins like it said in the question just have both ropes lie next to each other but have the second rope start from the middle of the first. So after 15mins the second will burn and the flame from this point the remainder of the first rope(15mins) and the second rope will burn 30 mins. Sorry for the poor spelling . Cheers Take one rope, fold it over so one end touches the other, then cut the rope in half. Place one half of the rope at the end of the second whole rope so their ends are touching. Then light either end for 45 minutes of burn. I can't assume rope properties, but nothing says I can't cut it in half. Fold Rope A in half. Lay it down next to Rope B, which is not folded at all. Light Rope B. Reminds me of some of the stupid questions in the Corvirtus test. I took one recently and felt like a 3rd grader. I'm Schmart, I swer. Make a plus sign the the ropes. Light any one end. 15 mins to get get to center, 30 to burn the other rope. Show More Responses Must be a crew of techies answering this question. The obvious answer is to look at a clock. lay both pieces of rope down so that end of rope A touches the end rope rope B light the end of either rope, after 30min have passed the flame will transfer to the other rope,when the rope is half burn 45 total min will have passed. so yes you can time 45min. 45 minutes is easy. I would rather have an hour of light. Tie the ropes together, making one long rope. Light one end and get 1 hour. The Question is "Given only 1 match, can you time 45 minutes?". Option 1. You have a timing device and are allowed to use it - no prohibition stated in setup or question - of course you can "time 45 min" to the precision of your timing device. Option 2. We know: Ignition can occur at either end. From reaction start to reaction end of each rope takes 30min. We can not assume that the rope burns evenly, can be bent, lit up other than the ends or even transmit the flame to the outside of the rope (Think trapped chemical burn in a tube). Therefore we can NOT build a timing device. Put one rope in a straight line, bend the second rope into an O shape (with both ends touching one end of the first rope), when the first rope reaches its end, 30 minutes will have passed, and ignite the second rope. The second rope, which has both of its ends ignited at the same time, will meet at its center, timing 15 more minutes have passed. -> ///////////O Lay down both ropes evenly side by side. Slide one rope down 1/2 the length of the other then light one of the ends. Make a "T" with the ropes. 1 rope burns in 30 min, that rope is touching the middle of the second rope, and with two equal halfs(30/2) it should burn in 15 mins. ----------- -------------, then push them together First of all, the question is "Given 1 match, can you time 45 mins?"... well you can stand there with a match in your hand and time 45 mins with any stopwatch. Or is the question really can you time 45 mins using that match? Then using the match to create a shadow..... hem hem maybe not. Let assume the question was meant to be "can you burn both ropes in 45 mins?"... well it doesn't say anywhere that the match can only light one rope. I've lit many birthday cakes in my days and I promise that only one match can light a full array of candles. So if the ropes burn in 30 mins. and you light both of them with the one match then yes; the burning of the ropes should be done under 45 minutes. But then again.... maybe the question was "can you burn both ropes in EXACTLY 45 minutes?" Now the real answer I think is that the question need to be more clear :) Light one of the ropes from one side only. when it burns out completely (30 mins) light the second rope from BOTH sides. that will double the rate at which it burns, making it completely burnt out in 15 mins. Total 45 min Show More Responses ***CORRECTION*** didn't realize the "one match only" make a loop and a long rope running out of it (like a key figure) light the loose end of the standing rope. it will burn in 30 min. When it reaches the end it will ignite both sides of the other rope, doubling the rate at which it burns (i.e. it will burn to completion in 15 min only) that's a total of 45 min. Keep the first rope straight, and the two tips of second rope touching one end of first rope. Now lit the other end first rope. So first rope takes 30 min to burn and transmit fire to two ends of second rope which will take 15 min to burn. So total of 30+15= 45 min The answer is simple... Make a sundial with the match and the rope. Can Keep the ropes in this fashion----------》 《--------- And fire dem with opposite side burning. Now when both fire meet it wil be 15 mints...nw both have 15 mints remaining now bur first remain rope which will take 15 mints more and den burn second remaining rope which will take another 15 mints..so total 45 mints..isn't it simple ..;) The question does not state that the items in the question are required to provide the answer so... Take note of your start time. Take the first length of rope and lay it next to the match. Then, carefully inspect the second length of rope for any defects. If none are found, or even if there are defects present, place the rope on the ground in a straight line facing north to south. Place the first length of rope, which is tired to the match, approximately 5 feet to the north of the second length of rope. **Warning: This step requires quick action on your part** While the match is burning, tie the first length of rope to the match. Take the second length of rope and touch the north end to the match while it is still lit. Grasp the second length of rope in your left hand and spin 360 degrees counter clockwise and throw it as far as you can. Now go have a beer and keep an eye on your watch to see when the 45 minute timeframe has finished. |

### Executive Assistant at Allied Telesis was asked...

How honest are you? 36 Answers100% honest, only lied once in my life.-Now Not very, including the answer to this question... I'm so honest that working for a company that has an employee rating of only 2.0 out of 5 was one of my last choices of potential employers. Show More Responses Honest enough to inform you, your question sucks There is honest and dishonest. I don't believe in variable honesty. That's not to say that I am honest nor perfect, but being honest indicates depth of character. And I strive to be honest. Shooot. Did I say you look like a great company to work for? Need I say more? "It's my biggest character flaw" .... "I don't think honesty is a flaw..." "I don't care what you think." Always completely honest. Which if I was a liar, then I'd be lying. But if I said I was always lying about everything, would I be lying about that too? Therefore the question is fundamentally flawed Average honesty. Is this a critical requirement that nobody else could fill? This statement is false. I am as honest as your question is. You decide the percentage of honesty to your question & the same would be the answer to your question. How honest do you need me to be? i'm not...therefore i am... Show More Responses Norman, coordinate.. Every person has it's price beyond which there is no honesty in anyone. We are only as honest as we feel, at the moment of temptation. If we knew that we could get away with murder, we would murder anyone who stopped us or said no to us...which is every day. I am the most honest dishonest person there is. Pretty fu@king honest Very. Honestly - trust me. Well..... since this position is to be your Executive Assistant... let's clarify the question.... - when you ask How Honest are you - do you mean, like ,,,being honest when it comes to covering for your rear end when your wife keeps asking me if you're having an affair with the 23 year old blond bimbo down the hall here ? ....well ... I don't have to be honest about THAT ...if you don't want me to be ...I guess That's a strange question...Why do you ask ? Are you running some kind of organized crime ring out of this company or something ? I don't like your company. Honest enough to tell you I don't want to work for a company with a 2 star rating on glassdoor.com I'm pretty honest.. I'm a computer genius :) But these days I wonder whether I'm really much good anymore Show More Responses I lie in every sentence, so I am very dishonest. Notice this ANswer is a paradox, If what I say was true, then I am infact being honest in this question, answering truthfully. If what I said was false, it meant that I am a honest person but I just lied to you about being honest. If i am answerable to my Soul,you will Find me amongst the Top People in the List of honesty. depending upon your understanding capacity. you are the judge to mesure my honesty. Very honest, but that doesn't mean that I will disclose everything. How honest are yooouu? As honest a human can be You would not know it if not familiar with me and my answer or most people can express is 'i'm very honest" "That suit looks nice on you!" 4 out of 5 What an interesting questions. If I tell you that I am an honest person, I could be lying, which in tern makes me a liar. I could be telling the truth, and actually be an honest person, but how would you know? Would a liar really call themselves a liar, or would they lie and state that they are honest? I think my actions would speak louder than my words. Please, feel free to contact my previous employers, as well as the references I have provided. They can tell you about their personal experiences with me, and then you can determine from that information if I am an honest person or not. Personally, I feel that I am as honest as I can be. Show More Responses If I told you I was dishonest, I would be lying. I'm probably the most honest person you will ever meet. Honesty died with the old timers. Sadly but true. As honest as I need to be, but no more. |

### Software Engineer at Facebook was asked...

You have two lightbulbs and a 100-storey building. You want to find the floor at which the bulbs will break when dropped. Find the floor using the least number of drops. 37 AnswersStart moving up in increments of 10 floors and dropping the bulb until it breaks (ie: drop from floor 10, if it doesn't break, drop from floor 20, etc.). Once the bulb breaks, move down to the floor above the last floor it broke on and start moving up floors in increments of one until the second bulb breaks. This results in a worst case scenario of 19 drops. Surely a binary search method would be more efficient i.e. starting at 50 and either going up or down 25 floors based on if it breaks or not. If you do a binary search, what happens if it breaks at floors 50 and 25? Show More Responses Do you know what a binary search is? You drop it from floor 12 next. If it breaks, you know it breaks between floors 12 and 1, inclusive. If it doesn't, you know it breaks between floors 13 and 25, inclusive. The main principle of binary search is that with each step you reduce your search space in half. Now your search space consists of only 12 floors. Wow, I want to get asked such a question in an interview! >>you drop it from floor 12 next... if you broke it on 50 and 25... you are out of luck and out of bulbs... 19 drops is not the best worst case scenario... imagine trying floor 16, if it breaks, you try 1 - 15 and thats 16 tries. if it doesn't break, then try floor 31 and if it breaks, then try 17 - 30 (so 16 tries, including the try on floor 16). And on and on (45, 58, 70, 81, 91, 100). If you reach 91, you'll have tried 7 floors so far and if it doesn't break, then there's 9 more tries to get to 100 (thus 16 in the worst case) Even a drop from the ceiling of 1st floor, a simple light bulb will break. thats what i think It's a light bulb. It will break when dropped from the 2nd floor. Drop it there then go to the first floor, hold it over your head and drop it. first do a binary search (agressive first step - fast) with 1 bulb. when first breaks, you know X(last but one fall - success) and Y(last fall - failure). now do a linear search starting from X(conservative but accurate second step - slow). complexity = in between logN and N. Use Binary search starting with the middle 50 The complexity of binary search is logN . So it will be log(100) < 7. Based on my experience, I think it will be floor 1 itself . Drop from 1st floor. If it didn't break, drop the same bulb from 2nd. If it still didn't break, drop the same bulb from 3rd... repeat as necessary. Only one light bulb required :) Yes, but doing each floor, that will give you the most drops -- question relates to optimizing for "least" number of drops -- I didn't think about being able to re-use the bulbs...that obviously is helpful. Maybe a fibonaci sequence once you determine a "break" floor and a "non-break" floor. I'd probably fail completely at coding it...knowledge of optimization and prediction theory would certainly be useful. Let f(m,k) be number of tries for m lamps and k floors. Obviously f(1,k)=k. let f(2,k) be s. k<=(s-1)+(s-2)...(1) =s(s-1)/2. Therefore f(2,100)=15. Show More Responses Actually, 16 is not the optimal, nor is 15; you can do it in 14. Here is one solution (there are at least 5 other equivalents): * Drop first bulb at 14th, 27th, 39th, 50th, 60th, 69th, 78th, 85th, 91st, 96th, and (optionally) 100th until it breaks. * Go to the highest floor where the first bulb didn't break. * Repeatedly go up one floor and drop the second bulb. When it breaks, you have your answer. Why is 14 optimal? Since you are decrementing each time, you want (n) such that sum(1..n) barely reaches 100. The answer is n=14. Generally, if the number of floors is (f), the lowest number of drops is ceil((sqrt(8*f+1)-1)/2). This is the best worst-case scenario. An interesting related question is what gives the lowest expected number of drops. And no, I could not have gotten this in an interview. In theory, use one bulb to determine an interval, and use the second bulb for a linear search within the interval. The solution that decreases the interval by one for each trial is quite clever. In practice, however, take the nature of the problem into account: Start on the first floor and move up by one floor. That's the answer I would be looking for. Start with bulb 1 and drop it from floor 2. Doesnt break? then floor 4 Doesnt break? keep dropping the same bulb moving even number of floors all the way upto floor 100. If on some even floor the bulb breaks drop the second bulb from the odd floor below the even floor, to detect if its the even or the odd floor that breaks the bulb Best case detection: 2 tries (first bulb breaks on 2nd floor, second bulb breaks on 1st floor) Worst case: 51 tries (the fist bulb breaks at 100 and second bulb breaks or does not break at 99th floor.. ) Go to the 100th floor and drop the first bulb. It WILL break. Done, 1 drop. It doesnt say whats the lowest floor it will break at, just at what floor will it break with least drops. Thus floor 100. Alright guys...you have two light bulbs. ...the second one has to be used for linear search, let the worst case number of items to be searched be x, then your interval will also have to be x, which will result a worst case of 100/x drops for the first light bulb. So now you are just trying to minimize n=100/x+x, find n'=0 when x=19...the candidate's answer is correct. I meant...x=10. and n=19. 0 drops, 1 bulb......stop thinking like computer nerds. Use physics or an engineering mindset. They didn't prohibit the use of any tools. Grab a scale, figure out force req'd to fracture bulb. Calculate acceleration due to gravity adjusting for air resistance/barometric pressure at location (trivial for anyone who took a 1yr physics course). Figure out how many meters up you need to be based on the req'd acceleration. Done.... @Rich: I am sure they were hoping for you to give them a computing answer since they don't do physics, and rather do computer science. mer's answer is correct: 14. Let F(s, n) be the optimal worst-case number drops for s stories and n bulbs. Suppose we drop at floor f, constituting one drop. If it breaks, we must make up to F(f-1, n-1) drops. If it doesn't break, we must make up to F(s-f, n) drops. Thus, for a given floor f, we have up to 1 + max { F(f-1, n-1), F(s-f, n) } drops. Optimizing over f: F(s, n) = 1 + min{ max { F(f-1, n-1), F(s-f, n) } for f in 1..s} Using the appropriate base cases, we have F(100, 2) = 14, as mer has given. Another way to think about it is in terms of decision trees. We want to construct a binary decision tree with leaf nodes for floors 1..100, and at most one "left" turn per path from root to leaf. To minimize the height of the tree, we want to reduce the variance in the length of each root-to-leaf path. This suggest we try dropping the first bulb at floors of the form: a, a-1, a-2, .. a-b, where the sum a + (a-1) + .. + (a-b) is equal to or barely over 100, so that determining almost any floor (possibly excluding the top few) takes a drops. Using this approach, we get the sequence of drops that mer has suggested. Well done @mer I have seen this question posed many ways, and that is the best answer I have ever seen. Sure hope I get asked this one now Show More Responses 14 In my experience light bulbs break when dropped from any height above 3 feet nice explanation from http://www.programmerinterview.com/index.php/puzzles/2-eggs-100-floors-puzzle/ Depends on how accurate u want to be. If i want exact answer, drop one from fifty, if it breaks start from first floor woth the remaining bulb. If it does not break, then start from fifty first florr. u will iterate fifty times as worst case. If u want a approximate answer, u can do binary way with give or take twenty five floors. Step over based on accuracy needed. You are all ignoring valuable information in this question. We are talking lightbulb, not bowling ball, and building, not step ladder. The bulb will almost certainly break by being dropped from the second floor (assuming US numbering conventions). The chance of it surviving a 3rd floor drop are miniscule, but not zero. The chance of a 4th floor drop, even less. Therefore, drop it from the 3rd floor first. If it breaks, go to the second floor and try. If that breaks you know the answer is 2. If it by some miracle doesn't break from the 3rd floor drop, the answer is 4, but take the elevator up one floor and drop it just to see. Rinse and repeat to 5, but since it will have already broken, go out and grab a beer, and tell your friends how much fun you just had. n*(n+1)/2 = 100. n approx = 14. In worst case u can figure it out in 14 drops. 14th, 27th, 39th, 50th, 60th, 69th, 78th, 85th, 91st, 96th, and (optionally) 100th until it breaks. I believe the number sequence should be: 14, 27, 39, 50, 60, 69, ** 77, 84, 90, 95, 99 **. The 9 floor gap between floor 69 and 78 would result in 8+8 = 16 drops worst case. Easy. Answer is zero. You don't need a test to find out that a lightbulb is going to break, even when you drop it from the first floor, because it's made of glass. BigO(100/X + X-1), Where X is the number of floors. 100/X calculates the dropping times to break the first one and X-1 is the additional maximum overhead to break the second one starting from the previous dropping floor to the floor the previous bulb was broken. If you solve the derivative of the above equation equal to zero, the optimal solution becomes 9.9 ~= 10 . Worst case = 100/10 + 10 -1 = 19 If its a glass bulb it will break from a 2ft height...i wont even care climbing any floors to check. Show More Responses Once you break the first light bulb, you are FORCED to start at the highest safe floor + 1 (i.e. highest floor that you safely dropped bulb #1 from) and drop bulb #2 one floor at a time, moving upward. Therefore, the algorithm for the first light bulb is critical (cuz once it breaks you are counting by 1's upward). Binary search starts at the 50th floor ==> max # drops = 50 Choosing fixed increments rather than binary search, e.g. start at 10, increment by 10, yields better results ==> 25 The ideal solution is 14 drops ==> Start at 14, increment by 14 each step until it breaks (leaving for the reader why 14 is optimal). It doesn't matter what floor you are on to make a bulb break. Doesn't it matter how high off the floor the bulb is dropped. If I am on the 5th floor and the bulb is sitting on the floor of the 5th floor, how high off of that 5th floor do I need to drop it before it breaks. This is a misleading question. The question doesn't say that you will drop the bulb out the window. Drop both from eye level. Both will break, and I answered the question without even climbing one stair. Efficiency isn't always about math..Common sense Answer: 14 drops Mathematically: 14 is the first number n, where the sum of numbers from 1 to n is greater than 100 Trial and error: The worst case happens when the bulbs break at floor 13. If you start from the 14th floor and the bulb breaks, then you start at the bottom floor and work your way up. If it doesn’t break and you try it again from the 28th floor and it breaks, then you go back down to the 15th and work your way up 1 floor at a time. |

### People Analyst at Google was asked...

how many basketball can you fit in this room 25 AnswersDepends ... should we assume they're inflated? Determine the volume of the room. For example if the room is 10ftx10ftx10ft the volume would be 1000ft cubed. The average mens basketball has a diameter of 25cm. There is approximately 30cm in a foot. Therefor you could fit one inflated basketball in a 1 foot cubed space. Therefor you could fit 1000 inflated basketballs inside a room with a volume of 1000 ft cubed. If we can deflate the basketballs and flatten them down to one inch thick, this would allow us to place 12 flattened basketballs in a 1 foot cubed space. Therefore you could fit 12,000 basketballs in a room with a volume of 1000 ft cubed. It would be more complicated depending on the shape of the room but the process for figuring out the solution would be the same. Actually, what you want to do is figure out the ratio of the diameter of the basketball to a full foot. Basketballs are 10 inches, and 10 is .8333 of 12. Remember that, then figure out the volume of the room by multiplying height by width by length---divide this number by .8333. BAM. So, if its a room of 12 x 10 x 8, you get a volume of 960. Divide by .8333. 1152 is your answer. And this will get it quickly. Show More Responses Oops, I didn't tightly pack the basketballs, it would be closer to 1728 inflated basketballs if they were all tightly packed in a 10ftx10ftx10ft room. The correct answer is 1. You only said "basketball" in the question. The actual question is: "How many basketball[s] can you fit in this room” my take on this as follows: 1. Assume the size of the room 10' (ft)x 10' x 10' = 120" (inch) x 120" x 120" = 1728000 cu inch 2. size of the Basketball = 9" (inch) x 9" x 9" = 729 (basketball size ref @ http://www.nba.com/canada/Basketball_U_Game_Court-Canada_Generic_Article-18039.html) 3. 1728000 / 729 = 2370.370 ~ 2370 Basketballs (you cannot add 0.370 balls) Thanks Instead of working it out, anyone ever replied with something along the lines of: I'm sure you don't need to know how many basketballs can fit in here. Why don't we skip this question and save some time? I can put infinite number of basketballs, as long as I can keep enlarging the room. I don't need to do all the math or know the size of the basketball (which can be very small anyways - given the current technology I assume people can make a "basketball" in nano scale? Your are assuming the room is "empty"... What about you and the interviewer and the desk and the chairs and so forth. Those things take up space as well. Think about it. Because a basketball, like most matter in the universe, is comprised of 99.9999999% empty space (really, just a few atoms bound together by a "gluing" force we know little about, separated by empty space), if you manage to make a basketball dense enough, you could fit nearly an infinite number of them into any room. I wouldn't want to be around when that happens, because such things tend to create their own gravitational pulls, and event horizons. Between 1 and 1 million basketballs. You did not specify your error tolerance or accuracy requirement. It is always a mistake to jump to conclusions and provide answers without collecting data and doing the backup analysis. Google it. not too many if we want to adhere to fire code requirements. let's google the local FD and ask for guidance. Show More Responses An infinite number if the door is left open. I can fit more basketballs in this room than beach balls, but certainly less than footballs or baseballs. I guess that highest packing efficiency can be achieved if the spheres [or in this case 'basketballs'] are packed in a face centered system. So we can divide the whole room in the number of cubes with each cube's side = diameter of basket ball. Since one cube contains 4 balls so answer should be = 4 * No of cubes. Bingo! I guess Two. Two basketballs will fit in nicely in the room. Or five. Or 10. Or three. All are valid responses. The question doesn't ask what is the maximum number of basketballs that could fit in the room. Think back to high school chemistry. The most efficient packing schemes - hcp and fcc - where spheres nestle in the valley created by the spheres of an adjacent layer, fill almost 3/4 of the available volume - the actual figure is pi/(3*sqrt(2)), a smidgeon over 0.74. That only holds in regions of uninterrupted packing of course; a lack of fractional balls around the edges of the room will introduce complications we can only ignore if the length of the room's sides are all much larger than the ball diameter. So if the room volume is h*w*l and the volume of the ball is (4/3)*pi*r^3, and {h,w,l} >> r, and the packing coefficient is pi/(3*sqrt(2)), then the number of balls is: h*w*l * pi/(3*sqrt(2)) ----------------- (4/3)*pi*r^3 after cancelling stuff out this reduces to: h*w*l ----------------- 4*sqrt(2)*r^3 That's a bugger to do in your head, but if you're happy with an approximate packing density of 3/4 (close enough since the aforementioned edge effects will make the true value arbitrarily lower anyway), you can arrive at this simplified and much more memorable formula for the number of basketballs:: volume of room * sqrt(2) / volume of basketball-sized cube I can fit in just one basketball in the middle of the room and enjoy watching it! Or, I can maybe order one large basketball the size of the room, get it inside the room and inflate it till it fills the room...like MM said, it's a question of how many and not what's the max no of basketballs one can fit in that room With a gleam in my eye and a wry smile, I'd ask, "When is your next vacation?" I'd give out any random number lets say 100... If he say I counted and thats what is the answer (confidently). If he denies then ask him to prove you wrong by getting 100 basketballs :D say a big number based on the room if they ask how or y tell them to check it out....... I would ask myself how many basketballs I have first. Show More Responses I think the answer is ZERO.firstly if u use standard basketball then by calculation you can get the answer, but its an interview not an exam. n if u try to fit a basketball of the size of room then too some space will be left on the corners. so i think its ZERO floor[room_length/basket_ball_diameter] * floor[room_width/basket_ball_diameter] * floor[room_height/basket_ball_diameter] |

### Linux Kernel Engineering at Google was asked...

You have 25 horses, what is the minimum number of races you can find the top 3. In one race you can race 5 horses, and you don't have a timer. 31 AnswersI don't know, but Google it, you'll find the answer. Once you know it, it's obvious. 12 Probably 8. First answer: at least 5 (you have to look at every horse). Second answer: 11. You can race five horses, replace 4th and 5th place horse by two horses from pool of horses that haven't raced, and continue doing this until all horses have raced. Since there are 25 horses, you need 1 race for the first five horses and 10 to go through the remaining 20. Third answer: 8. Round 1 (5 heats) : Race horses in heats of five. Eliminate all 4th and 5th place horses. (15 horses left) Round 2 (1 heat): Race winning horses from every heat. Eliminate 2nd and third place horses that lost to horses in round 2 that came third or worse. (7 horses left). Round 3 (1 heat): Pick any five horses. Race them. Eliminate bottom two and replace with remaining two horses. (5 horses left) Round 4 (1 heat): Eliminate bottom two. Note: after round 2 it may be possible to use some interesting decision tree mechanism to determine the three fastest horses using fewer horses per heat but you still need two heats to do that. This problem assumes horses don't get tired, no ties are possible and a horse's speed is deterministic race after race after race. Good assumptions for brain teasers, but not for real life. Show More Responses Actually, should be 7. Forgot that after round 2 you can eliminate one more horse leaving you with 6 horses, one of which (the winner of the second round), is the fastest horse of them all. One more race with the five horses not No.1 and you pick the top two. 6. First round consists of 5 races of 5 horses. Pull aside the winner of each race in the first round for the final heat and eliminate the bottom 2. 8. Run 5 races of 5 horses. (5) Put all the 3rd place horses in a race, winner is 3rd fastest. (6) Put all the 2nd place horses in a race, winner is 2nd fastest. (7) Put all the first place horses in a race, winner is fastest. (8) The third place horse was beaten by one of the 2nd place horses. So third stays in third. Same for the second place horse. chzwiz, r u sure u r not high? B, what happened in round 2? why 8 horses suddenly get eliminated by 1 race? again, do u know what you are smoking? oh, forget J,..... just speachless 7. chzwiz, your answer is incorrect. One of the first or second place horses could be 2nd fastest and/or 3rd fastest. I drew a grid to visualize the problem. First, run five races to establish 5 groups of internally ranked horses, and you can of course immediately eliminate 4 & 5 of each race. 1 2 3 x x 1 2 3 x x 1 2 3 x x 1 2 3 x x Then race 1st place horses, eliminate 4 & 5, and those they beat earlier. You can also eliminate the horses #3 beat, and the 3rd place horse from #2's first race. 1 ? ? X X 2 ? X X X 3 X X X X X X X X X X X X X X You know #1 is fastest. Race the remaining horses (2, 3 and ?'s), and the top two are 2nd and 3rd. After reading the above answers, this is the same as B's revised answer, but I found it easier to explain/visualize with the grid. @brad ... but isnt dat v dont have timer to know d ranking ... or my assumption is wrong?? I thought v know only 1 result of every race .. i.e. top 1 Spawn, it's true that you don't know timings, but you do know RANKINGS. I don't see errors in logic with each answer above. They may claim to discover the answer with fewer races, but they have too many assumptions or errors to be correct. To do this optimally and without any potential error, you must eliminate as many correctly placed horses as possible and eliminate the maximum number of non-win/place/show horses each round. Round 1: (Races 1-5) You must start with 5 heats @ 5 horses apiece. The non-Win/Place/Show horses of each round have been eliminated, leaving 15 horses. Round 2: (Race 6) You then race the top finishing horses against one another, leaving you with your overall fastest horse. We now have the Win horse, leaving only Place and Show as unknowns. This also eliminates the bottom two horses, leaving 2 horses from this race. There are also only two more unknown horses. Race 7) You may race the Place horses against one another. Only two survive this race, since we know that each of these horses can place 2nd at best. This leaves 2 horses from this race. (Race 8) You may also race the show horses of each round. Since they each have been beaten by two other horses in Round 1, only the 1st place horse of this round survives as the potentially 3rd best horse. This will leave 1 horse in this race to battle for the 2 remaining spots. Round 2 leaves 2 Horses (Race 6) + 2 Horses (Race 7) + 1 Horse (Race 8) = 5 Horses, for 2 unknown spots. Round 3: (Race 9) We can now have the final 5 horses race for the remaining two spots leaving us with the undisputed 2nd and 3rd places. Here is a more complex scenario below in which the top 2 horses come from the same original race and the later races are full of lame horses. Many of the solutions above do not address those problems. Each # is a horse, named by it's inherent ranking. X signifies 'eliminated horse' Race1 R2 R3 R4 R5 1-->R6 3-->R6 11-->R6 16-->R6 21-->R6 2-->R7 7-->R7 12-->R7 17-->R7 22-->R7 4-->R8 8-->R8 13-->R8 18-->R8 23-->R8 5X 9X 14X 19X 24X 6X 10X 15X 20X 25X Round 2: Race 6 (Winners) Race 7 (Places) Race 8 1 -->1st Place 2-->Race 9 4-->Race 9 3 -->Race 9 7-->Race 9 8X 11-->Race 9 12X 13X 16X 17X 18X 21X 22X 23X Round 3: Race 9 2P 3S 4X 7X 11X First Place = 1 Horse -- Race 6 Winner Second Place = 2 Horse -- Race 9 Winner Third Place = 3 Horse -- Race 9 2nd place To fix the formatting issues that appeared as spaces are eliminated above-- Race1________R2___________R3___________R4___________R5____ _1-->R6_______3-->R6_______11-->R6_______16-->R6_______21-->R6 _2-->R7_______7-->R7_______12-->R7_______17-->R7_______22-->R7 _4-->R8_______8-->R8_______13-->R8_______18-->R8_______23-->R8 _5X__________9X___________14X__________19X___________24X _6X__________10X__________15X__________20X___________25X Round 2: Race 6 (Winners)__________Race 7 (Places)__________ Race 8 1 -->1st Place_____________2-->Race 9______________4-->Race 9 3 -->Race 9_______________7-->Race 9 _____________ 8X 11-->Race 9______________12X____________________13X 16X_____________________17X____________________18X 21X_____________________22X____________________23X Round 3: Race 9 2P 3S 4X 7X 11X Less ascetically pleasing than the original, but it will suffice. Show More Responses This problem can be reduced to (viewed as) multiway mergesort: 1) split the horses into groups of five as if we had five files to sort 2) do a multiway mergesort but instead of sorting all horses, stop as soon as you get the top 3 We need one race per group to sort them (5 races total). And 3 more races to get the top 3. We will need 8 races. The interviewer might have been looking whether an applicant was able to spot this relation to algorithms or not. But if this was a brain teaser instead, maybe the answer is less than 8. The answer is definitely 7, here is a fantastic explanation: http://www.programmerinterview.com/index.php/puzzles/25-horses-3-fastest-5-races-puzzle/ Randomly race the horses 5 times and keep a winner's bracket. The 6th race will determine the fastest horse. This is trivial. The 2nd and 3rd fastest could be in the winner's bracket or they could be the 2nd or even 3rd fastest in one of the losing brackets. Then we have to race 2nd and 3rd place from the winners bracket as well as from each original bracket, which had 5. This means we have 12 horses to try. Randomly keep 2 horses out and race 5v5. Keep the top two horses from both. We have 6 horses now. Race 3v3 and keep the top two, leaving 4 horses. Then race these. I count 11? Brute force divide and conquer solution = 18 races. Just be aware of the brute force solution in case there's restriction where we can't use the memory to save the first 3 places. Those who want a system that averages that fastest solving time, the answer will be 7 races.. Those gamblers who want an algorithm that gives the fastest possible solving time (all though sometimes it WILL take longer) the answer is 6. Race 1-5: First 5 races of five.. We randomly seed with no overlaps.. we use this to eliminate the bottom two from each race. I am going to use a two digit number labeling system where the first digit is which race in heat one they competed in and the second digit is which place they obtained in that heat.. These are the horses we have left: 11 12 13 21 22 23 31 32 33 41 42 43 51 52 53 Race 6: We have the winners from each heat compete, and for ease of explanation lets say that they ranked 11, 21, 31, 41, 51.. Now we know that 41, 51 and all the horses slower than them (their heats) are out.. also, we know that any horse slower than 31 is out (ie. 32 & 33), and we know that any horse that is at least two horses slower than 21 is out (ie 23). This leaves 11, 12, 13, 21, 22, 31.. 6 horses. Possible rankings: 11 12 13 21 22 23 31 32 33 Race 7 Rank 1 is already known.. and we just need to know how to organize 12, 13, 21, 22, and 31.. And look at that!! that's 5 horses! We race those 5 and the top two receive the overall rank of 2nd and 3rd. 5 races in round one, 1 race in round 2, 1 race in round 3.. it took us 7 races.. Option two: 6 Races Now, an alternate answer.. when we read "What is the minimum number of races to find the top 3 horses" we can interpret that maybe they don't care about this method working every time.. instead they want to hit up the Vegas Casinos and test their luck, and maybe save some track time.. If i was a gambling man.. i would race the first group of those that i thought looked the strongest.. I would eliminate 2 in that race (we are now down to 23 horses).. and then race the 3rd fastest multiple times and hope that he gets first in the remaining races, thus eliminating 4 horses each time. This is going to be painful for the horse that placed 3rd in heat one. Race 1: Eliminate 2, 23 horses remaining Race 2.. Eliminate 4, 19 horses remaining Race 3.. 15 horses Race 4.. Eliminate 4, 11 horses Race 5.. Eliminate 4, 7 horses Race 6.. Eliminate 4, 3 horses.. The original top 3 from Race 1. So using method 2, we completed this race in 6 races instead of 7! I messed up the possible ranks after race 6.. That should have read.. 11 12 13 11 12 21 11 21 22 11 21 31 Please forgive me. Brad's explanation is the perfect one. All other explanations are junk and impossible to read and follow. Round1: (5 groups) remaining horse 15 Round: (1 groups). Topper from each heat Round: (1 gounds). Forget about the 4th and 5th Heat horses (becoz their toppers are at last place) go to the 3rd position 6 races as the 25 horses are divided into 5 groups each grouping 5 horses in each group , then the winner from each group would be 5 then there should be last n final race to find the first , second and third placed horse . in this way we can find our top 3 horses :) It should be 11. In each race you can only eliminate 4th and 5th place simply because there's a chance that the top 3 in that single heat are the 3 fastest of all the horses. So each race you can select 5 random horses each race or keep the top three in the following race, the outcome is the same. Show More Responses I get 8 races to guarantee you get the top three. 5 races of 5 to get the fastest horse from each group. 1 race to determine the fastest overall. The second fastest horse can be in the group (x) that produced the fastest, 1 race with the remaining 4 fastest from the other groups and the second fastest from group x. That race will produce the second fastest overall guaranteed. 1 more race with the 3 or 4 from the original winners and the replacement from the group that produced the second place horse. That makes 8 races. I dont get it.. It shoudl be five races right? U will know how long each horse takes to cover same distance. Pick the three that took shortest. Y need more rounds? If u down vote my answer, u have the obligation to explain why 😜 Answer is 6. You will have 5 races and 5 winners. Next race with 5 winners is the 6th race and you get top 3. You're welcome. It would be 7, mainly because since there only 5 racers each round, then it would be tournament style. As you can tell, tournament style never determines the rankings in the short term. (Imagine if a new tennis player played against Roger Federer and he loses. He's not bad, he's just really unlucky haha) So in order to determine the answer, you would have to use massive logic and reasoning. First step is obvious: you get 5 sets of horses to race through 5 races. So the number is already at 5. We get the top horse in each one and note them. However, one problem is that you have to consider if fastest horses could lie all in the first, second, third, fourth, or fifth group. But we can't determine that yet, so let's race one more time with the winners of each race. Second step: Race with each winner from their groups. That makes 6 total races so far. Ok, now we can get somewhere with this. So now, its a question of which horses we can eliminate to determine the next race. Who can we eliminate though? Well, we can get rid of: - All the horses in the group with the last race that were 4th and 5th place. This makes sense since if the winner of their groups only made 4th and 5th place in the tournament style race, then they are definitely not the fastest horses. 15 horses remaining. - Well, we can also get rid of the last two horses of each group since we are only looking for the top 3. 9 horses remaining. - We also can get rid of the first place winner since we already know he is definitely the best. 8 horses remaining. - Since we already determined who the fastest horse is, now we have to determine who the second and third fastest horse can be. In that case, the second place horse from the last round can get rid of the third horse of that group, since he definitely has no shot of being the first or second fastest horse of this new race. Also, in the third group, we can get rid of the second and third horse in the group due to the same reasoning above. 5 horses remaining. Oh wow! We now have 5 horses left! This means we can just have a clean race and find the second and third fastest horse. So overall, the answer is 7 races! 7 In my opinion, you need 26 RACES to make sure that you get the top 3 without a timer. You need to know that without a timer if we plan only 5 races with 5 horses on each one, the last horse on the first group could end the race in 1 minute while the first horse on the second group (the winner) could end it in 2 minutes, which mean that the last horse of the first group is much faster than the first horse of the second group..and this is why we need to make a total of 26 RACES to determine the top 3 as follow: 5 RACES with 5 horses each .> We get the 5 winners from each race .> We race the 5 winners > We get the top 4 > We race the top 4 with one of the remaining 20 horses > we get the top 4 > we race the top 4 with one of the remaining 19 horses > we get the top 4 > we race the top 4 with one of the remaining 18 horses...etc until the last race then we select the top 3 winners from the last race. 5 RACES + 1 RACE + 20 RACES = 26 RACES HERE IS THE METHOD FOR THE MAXIMUM RACES😂😂 5 races 5 horses in a race, then repeat so you have a larger pool of data and more accuracy. Then take all the 1 and 2nd place winners that changed horses and run them 1 on 1 which ever wins takes the spot (0-20 races), so now you have 10 horses left. Split them into 2 groups and race each group twice repeating the 1 on 1 method using the first and second place horses, now you have 4 horses race them all in one race, run it twice again doing the 1 on 1 method. So that totals to 31 races...I think...also would be about time to retire these horses after 31 races LOL Shoot 36 races not 31 |

Given a fleet of 50 trucks, each with a full fuel tank and a range of 100 miles, how far can you deliver a payload? You can transfer the payload from truck to truck, and you can transfer fuel from truck to truck. Extend your answer for n trucks. 23 AnswersSo 50 trucks is solvable but annoying. The answer depends on payload size, also if the truck needs to return. If we assume no return and 1 truck can carry the payload. Make the number of trucks 64 for even powers of 2. The trucks all take off together and every 50 miles they all have half full tanks. Half of the trucks are sacrificed to refill the other half. Number of trucks goes from 64 -> 32 -> 16 -> 8 ->4 ->2 -> 1. So 6 splits * 50 miles = 300 + last truck has 100 miles. 400 for 64 trucks. 50 can be solved with annoying fractions. General answer is 50 * log(base2) of n + 100. :-) Yes, your assumptions are correct, and so is your solution. The answer is 450 miles. it is the sum for n=1 to 50 of [ 100 / (50-n) ] After 2 miles you would transfer all of the fuel from one truck, and could fill all 49 of the other trucks. (100mile range / 50 trucks = 2 miles before the first truck could be emptied of all fuel and is not needed to carry any fuel) at that point you only have 49 trucks, so 100/49 is the distance before you park the second truck. After parking 49 trucks you would have one full truck of fuel that would finish the last 100 miles. General solution for X trucks with Y range is Sum for n=1toX of [Y / (x-n)] Show More Responses My equation was off by one, need to sum for n=0to49, not 50. (since 100/(50-50) is infinite obviously it was in error.) The answer is quite simple. You can deliver the payload an infinite distance. Since you have 50 trucks at your disposal you can run one truck with the payload until its near empty then transfer the payload to a full truck. The near empty truck can re-fuel and then drive towards the destination re-fueling as needed. Once the truck with the payload is near empty it can transfer the load to a truck that has recently been refueled. The answer is quite simple. You can deliver the payload an infinite distance. Since you have 50 trucks at your disposal you can run one truck with the payload until its near empty then transfer the payload to a full truck. The near empty truck can re-fuel and then drive towards the destination re-fueling as needed. Once the truck with the payload is near empty it can transfer the load to a truck that has recently been refueled. Ua… Everyone needs to try again... Two trucks go 33 1/3 miles out and the second truck gives ½ of its remaining 2/3 of a tank to the other truck who parks and waits for the other truck to go back. It has enough fuel to return and comes back out with another truck who does the same thing but now we have two trucks 33 miles out and both with 2/3 of a tank or 66 2/3 miles of fuel remaining. With this method of inch worming and returning to refuel you can achieve a spacing of 33 1/3 miles between each truck and continue to refuel the entire chain. Only then once the entire refueling chain is stretched out to the range of 1666.66 miles you can have a truck be totally fueled 100% and then go either 50 more miles and still be theoretically able to return back to home base or 100 miles to sacrifice the truck for a delivery giving you a maximum range of (n + 1) * (1/3 of range) yielding a potential range of 1766 2/3 miles. You use a lot more fuel getting out to where you want to go but your range is increased well above the 400 miles range and the trucks aren’t lost. It is 1800 not 1766... I did the same 0 to 50 vs 1 to 50 miscalcuation. 100 + 51*100/3 = 1800 Ua… Everyone needs to try again... Two trucks go 33 1/3 miles out and the second truck gives ½ of its remaining 2/3 of a tank to the other truck who parks and waits for the other truck to go back. It has enough fuel to return and comes back out with another truck who does the same thing but now we have two trucks 33 miles out and both with 2/3 of a tank or 66 2/3 miles of fuel remaining. With this method of inch worming and returning to refuel you can achieve a spacing of 33 1/3 miles between each truck and continue to refuel the entire chain. Only then once the entire refueling chain is stretched out to the range of 1666.66 miles you can have a truck be totally fueled 100% and then go either 50 more miles and still be theoretically able to return back to home base or 100 miles to sacrifice the truck for a delivery giving you a maximum range of (n + 1) * (1/3 of range) yielding a potential range of 1766 2/3 miles. You use a lot more fuel getting out to where you want to go but your range is increased well above the 400 miles range and the trucks aren’t lost. Ua… Everyone needs to try again... Two trucks go 33 1/3 miles out and the second truck gives ½ of its remaining 2/3 of a tank to the other truck who parks and waits for the other truck to go back. It has enough fuel to return and comes back out with another truck who does the same thing but now we have two trucks 33 miles out and both with 2/3 of a tank or 66 2/3 miles of fuel remaining. With this method of inch worming and returning to refuel you can achieve a spacing of 33 1/3 miles between each truck and continue to refuel the entire chain. Only then once the entire refueling chain is stretched out to the range of 1666.66 miles you can have a truck be totally fueled 100% and then go either 50 more miles and still be theoretically able to return back to home base or 100 miles to sacrifice the truck for a delivery giving you a maximum range of (n + 1) * (1/3 of range) yielding a potential range of 1766 2/3 miles. You use a lot more fuel getting out to where you want to go but your range is increased well above the 400 miles range and the trucks aren’t lost. And if you want to be creative - 25 of those trucks can toe fully-fueled 25 trucks. Wanna try again? This is a straightforward programming problem. Clever solutions such as allowing the other trucks to refuel and allowing other trucks to tow extra trucks full of fuel rarely impress the interviewer. The simplest solution involves recursion, or induction. Imagine a function f(n) where f(n) is the distance n trucks can carry the load, the problem defines f(1)=100, and we're asked to solve for f(50), so our job is to solve for f(n) in terms of f(n-1), f(1) and n. It's safe to assume each truck, including the fully loaded truck will travel the same distance and that fuel is used uniformly over the distance. So with n trucks, the trucks should travel just far enough that n-1 trucks have room in their tanks for the nth truck's fuel, then transfer an solve for n-1. This equation is f(n) = f(1)/(n) + f(n-1) (All perl vs python vs ruby/etc wars aside) Plugging this into a simple scripting language such as perl is an easy way to solve this: sub f{ my $n = shift; return 100 if($n == 1); return f(1)/($n) + f($n-1); } print "50: " . f(50) . "\n";' On the command line, this gives a quick answer: > perl -e 'sub f{ my $n = shift; return 100 if($n==1); return f(1)/($n) + f($n-1);} print "50: " . f(50) . "\n";' 50: 449.920533832942 Approximately 449.92 miles with 50 trucks. The recursive subroutine above will suffice as a general solution in terms of n. Not a programmer but this is how I solved it. You obiously want to shed a truck as soon as the other trucks have room for the fuel from one truck. Since trucks have a range of 100 miles when all trucks have a tolal of 100 miles you can refill all truck s from one truck's remaing fuel. 100 miles divided by 50 trucks is 2 so two miles is the first refueling point at which time you will lose one truck. So I set up a Excel worksheet. Column A number of trucks beginning with 50 down to 1. Column B has formula 100/A1. Sum column B is 449.9205. Same as other s have come up with. Show More Responses This would depend on the fuel efficiency of the trucks. You could almost certainly get much farther by having the first truck tow all 50 others, once it runs out of fuel take it out of the train and continue on. One truck pulling others will still get better fuel efficiency than all trucks by themselves. ie you get 10mpg from a truck by itself, and 7 with it pulling the others, vs all using 10mpg at once. 50 trucks with a 100 mile range. The question does not state that all the trucks have to be in the same place to start. It's pretty easy. All the trucks are 100 miles apart. Therefore you can transfer the payload up to 5000 miles. I hate these problems. The interviewer is normally probing for a specific answer, and unwilling to understand that the question is fundamentally flawed, and whit they are looking for is being asked in obtuse way, often for the a wrong answer. Much of hte answer depends on what is or is not available in this crazy mad max world. Is there no more fuel in the world? Can the trucks refuel at the main depot? Is it okay to leave trucks parked on the side of the road? Sometimes the interviewers are asking about how you validate assumptions or deal with your own invalid assumptions of the world... normally not. Of course the normal answer would be 50 or 45 miles range. Shifting loads and siphoning fuel is a pita. The next answer would be get a CFN card and trusted drivers, then range is more limited by periodic maintenance i.e. oil changes. Failing that, as was done during the 1970s oil crunch, get some 50 gallon drums and tie them up to the back of the headache bar. Each gallon of diesel weighs about 8 lbs, and can get you about 4 miles down the road. The united states is about 3000 miles wide. That takes about 6000 lbs of fuel. To get back another 6000. It's not very efficient, but you won't get stuck on the side of the road. due to fuel reasons. But if you want a wanky CS answer. ( similar to JP's answer, but carrying it to stupidity). With trucks returning to an infinitely fueled depot: ( my favorite extra world pieces). By driving two trucks too 50 minus a smidgen miles. Park a truck with a driver in it, and it will have a smidgen of fuel in it. The other truck will keep making trips from 0 to 50 minus a little and transfer it's excess fuel to the parked truck. Eventually there is a fully fueled truck 50 (minus a little) miles from the depot. This chain can be extended one link at a time like some horrible towers of Hanoi problem. Finally you end up with a line of n-1 fully fueled trucks. This line alone stretches 2450 miles (minus 49 smidgens). The last truck in the line could round trip out to 2500. ( n * range/2) After you have a row of fully fueled rucks 2450 miles long, there might be something funky you could do with it to extend the range. Truck 1 would have 1/2 a tank at the next truck, 25 miles into the second leg it could park and the second truck would then have a full tank at 75 miles from base, but not be able to return. Scale this up across the entire line of trucks. ... one short throw away perl script later... looks like that'll get you about another ~100 miles. so almost 2600 miles with parked empty trucks. Maybe a nonlinear spacing would be beter, not sure.. don't care really. The fundamental answer is that most CS wanking stuff is often irrelevant in the real world. Money money money, cost cost cost. 50 trucks is somewhere in the piles of money range, quit wasting fuel. very simple to understand solution public class test { public static void main(String [] args) { int num=50; double result=0; for(double i=num;i>0;i--) { result=result+100/i; } System.out.println(result); } } Wow, Daren up top is definitely correct. I propose it's a little simpler than that. It is just the summation of n=1 to n=50 for 100/n Call the last truck the first truck, n=1. being full, it can go 100 miles. when there are 2 trucks left, 50 miles repeated down to the starting fleet of 50 trucks going 2 miles. pretty sure using x-n doesn't bring the world down on itself, but it's unnecessary and makes that 49 to 0 error much easier to fall for. @Daren Yes I reached the same equation as well. Sum for n=0 to 49 of [ 100 / (50-n) ] A quick spreadsheet run shows the result as 449.92 miles. It's a horrible and pointless thing to ask this question in an interview without the help of a calculator or spreadsheet. I guess my brain also oversimplified the problem. Since it was never stated that all 50 trucks needed to start from the same location I spaced them 100 miles apart towards the destination. If fuel is easier to transfer at each 100 mile point transfer fuel; else transfer payload for a maximum payload delivery distance of 500 miles, OR Number_of_Trucks * Range = Maximum_Payload_Delivery_Distance I'm a software engineer, but would have answered this completely differently. You have 50 trucks with a value of say $70,000 each, and 50 full fuel tanks. Sell 49 trucks, drive the 50th to the local fedex and and tell them where to deliver the payload . With the money remaining buy a villa in the South of France and retire. ques is how far u can deliver the payload that totally depends on the ranging limit of fleet of trucks that is 100 miles . it means they cannot move before 100 miles even if we transfer the fuel one after the another it has no sense here , let suppose one truck travels 100 miles (max) , we are not considering that it get emptied before reaching 100 miles after that next truck travels , so the total of distance that could be travelled is 100*50 miles = 5000 miles (this is the max distance the payload can be taken ) while the least could be 100 miles . Ok first determine the payload capacity of a truck. How many trucks required for payload. Assign one or mire truck to carry the fuel of other trucks which wont be delivering |

### Software QA Engineer at Apple was asked...

There are three boxes, one contains only apples, one contains only oranges, and one contains both apples and oranges. The boxes have been incorrectly labeled such that no label identifies the actual contents of the box it labels. Opening just one box, and without looking in the box, you take out one piece of fruit. By looking at the fruit, how can you immediately label all of the boxes correctly? 40 AnswersAll the three boxes are names incorrectly. SO the bax lebeled Apples+Oranges contains only Oranges or Only Apples. Pick one fruit from it. If it is Orange then lebel the box as Orange. So the box lebeled Oranges contains Apples and the remaining contains both. Label the boxes fruit. The key bit is "All the three boxes are names incorrectly" so the label on the box which fruit comes from will need to be changes to one of the other 2 labels. It can only be 1 of them (and it will be obvious when you have the fruit) then the remaining box (that hasnt featured yet)...Just swap that label with fruit box that was originally on the box which you took the fruit out of Thats hard for anybody to understand somebody elses explanation... eaiest way is to just do an example Show More Responses Swaz answer is almost correct however it does not work in all scenarios. lets assume: box 1 is labelled Oranges (O) box 2 is labelled Apples (A) box 3 is labelled Apples and Oranges (A+O) and that ALL THREE BOXES ARE LABELLED INCORRECTLY" Pick a fruit from box 1, 1) if you pick an Orange: - box 1's real label can only be O or A+O - box 1's current label is O - since ALL LABELS ARE INCORRECT then box 1's real label can not be O - box 1's new label should then be A+O by elimination - since ALL LABELS ARE INCORRECT - box 2's label is changed to O - box 3's label is changed to A - SOLVED 2) if you pick an Apple: - box 1's real label can only be A or A+O - box 1's current label is O - since ALL LABELS ARE INCORRECT then box 1's real label can not be O - this still leaves us with the choice between label A and label A+O - which would both be correct - FAILURE Solution: The trick is to actually pick a fruit from the A+O labeled box Pick a fruit from box 3: 1) if you pick an Orange: - box 3's real label can only be O or A - box 3's current label is A+O - since ALL LABELS ARE INCORRECT then box 3's real label can not be A+O - box 3's new label should then be O by elimination - since ALL LABELS ARE INCORRECT - box 1's label is changed to A - box 2's label is changed to A+O - SOLVED 2) if you pick an Apple: - box 3's real label can only be O or A - box 3's current label is A+O - since ALL LABELS ARE INCORRECT then box 3's real label can not be A+O - box 3's new label should then be A by elimination (not O) - since ALL LABELS ARE INCORRECT - box 1's label is changed to A+O - box 2's label is changed to O - SOLVED it only says you can't look, doesn't mean you can't feel around or smell the fruit you picked, easy deduction after you figure the first box out Sagmi is right, but did not give the full reasoning. "the bax lebeled Apples+Oranges contains only Oranges or Only Apples. Pick one fruit from it. If it is Orange then lebel the box as Orange." so far so good Now, the box labelled Apples cannot be the box containing only Oranges, you've just found that box, so it must contain Apples and Oranges. And in that case the other box, labelled Oranges, must contain only Apples. It's easier to draw it out. There are only 2 possible combinations when all labels are tagged incorrectly. All you need to do is pick one fruit from the one marked "Apples + Oranges". If it's Apple, then change "Apple + Orange" to "Apple" The "Apple" one change to "Orange" The "Orange one change to "Apple + Orange" If it's Orange, then change "Apple + Orange" to "Orange" The "Apple" one change to "Apple + Orange" The "Orange" one change to ""Apple" Since all 3 boxes are labled incorectly Start with the box Labled A&O. If Its apples than the box labled apples then the apple one is oranges and the oranges is O&A. Label each box "Apples and/or Oranges" and the all will be correct. This is very simple to resolve. I was asked the same question at FileMaker. Each box is incorrectly labeled. So you go to the box that is labeled "Oranges and Apples" and take one out. It doesn't matter what comes out because all that you know is that it is not AO. If you remove an Apple then move the Apple label to it. Since the Apples are already identified it is easy to resolve the rest. All you know for certain is that the other two boxes remaining are mislabeled. So the AO label goes on the box with the remaining label and that label goes on the Apple box as you have already assigned that. The end result is you only need to remove one piece of fruit to figure out the proper locations of all. Go down the road to HP. Maybe they are hiring. Some of these pseudo-problem solving questions like this are bunk. I was once asked why sewer covers are round and not square. I gave the correct answer without even hesitation and the interviewer seemed put off that I knew the answer. I didn't get the job but, in hindsight, no great loss. I prefer the questions (like the basketballs one from google) where you won't be able to give an accurate numerical answer but by explaining HOW you would go about solving the problem is all you need to do and MAYBE shows your aptitude for problem solving. Smell the box you opened. Step 1: Order the boxes by weight. Either apples weigh more than oranges, or oranges weigh more than apples. The mixed box will always be in the middle. Step 2: Open the first box, take out the fruit and look at it. Step 3: If the fruit is an apple, deduce that the middle is apple and oranges and that the third box is oranges. If the fruit is an orange, then deduce that the last is the box with the apples. Show More Responses Donna is the only one with any common sense. The problem with corporate America, is that it's run by a bunch of Bozos who over complicate things and have a narrow to zero vision on how to solve even the simplest problems. I can imagine that most of you would get a committee, have long meetings where you talk about 'think out of the box', and 'at the end of the day' nonsense. This is an interesting logic question, but I would not want to buy fruit from a company who knew they had a problem and then sampled one out of three boxes to resolve the issue. There are other correct answers posted. I'll just make a comment: "The boxes have been incorrectly labeled such that no label identifies the actual contents of the box it labels." Nothing in the above statement says the labels are limited to oranges/pears, only that they do not identify the contents. They could say 'nuts', 'bolts', etc. Technically, all answers should be prefaced with: assume that the labels say 'oranges', 'pears', and 'orange/pears'. Ok, the problem does not make sense and is unsolvable if the labels say 'x', 'y', 'z', but someone with (likely with a math proof back ground) may appreciate attention to detail. Q: Why do posters denigrate the interview questions? The questions, however stupid they may be, are a opportunity to show you can build an answer. Even if you pursue an invalid train of thought in the interview, it's a thought. It's what they want to see and what will help you get a job offer. Note: I also would not assume that the questions asked are a reflection on the company, department, or team as a whole. It may just be the interviewer that has chosen poorly. So to say "I don't want to work for company X because they asked me a stupid interview question" is pretty closed minded. To even think I don't want to work with that interviewer just based on questions asked seems extreme. rightly pointed out by Sagmi ... this question was put forward to me at Huawei Technologies and that was the answer I gave So the question was asked at an interview for Apple: Label ALL the boxes apple and charge a ridiculous price for them! Just label all of them "Fruit." Put another way, it is not possible to tell since we don't know how the boxes are mis-labled. What if the Apple box was labeled Oranges and both the other boxes were labeled Apples and no box was labled Apples and Oranges? You might have assumed there are three different labels when their might have only been two different labels. Always pict a piece of fruit from the box labelled Apple&Orange. As we know that this label is wrong, there are two possibilities: If it is apple, then wo know that this box should be labelled Apple, so we switch Apple label with the label Apple&Orange. Then Apple label is correct. We also know that the Orange label is incorrect, so we then switch Orange label and Apple&Orange label. if it is orange, then we know that this box should be labelled Orange, so we switch Orange label with label Apple&Orange. Then Orange label is correct. The same as above, we know that the Apple label is incorrect, so we switch Apple label and Apple&Orange label. If all boxes are labeled incorrectly and u pick a orange out of a box that's labeled apple/oranges change the name to oranges then change the box labeled oranges to apples and the the box labeled apples to apple and oranges... If you pick a apple out of a box labeled apples and oranges change the name to apples and then change the box labeled apples to oranges and the last to apples and oranges... If u pick a apple out of a box labeled oranges change it to apples and oranges then the box labeled oranges to apples and the box labeled apples to oranges...if you pic a orange out of a box labeled apples change it to apples and oranges and the box labeled oranges to apples and the last to apples and oranges... See the pattern? I think there is a big box and it contain two small boxes and all the labels are incorrect so big one contain two boxes that makes it carrys both orange and apples and in that thwo boxes having orange and apple respectively so if we open any box we can label it correctly Show More Responses To see the java source code of puzzle, visit: https://github.com/SanjayMadnani/com.opteamix.microthon code is taking the input by console only. You can fork or clone the repository and proceed further. You can also rise bug if you find any. Run BasketPuzzleGameTest.java class as a Junit test case to start game. if it known already that boxes labeled incorrectly, I would give it back to those who did label them and ask to fix this confusion. it is impossible to tell by opening only one box, so you have to open one more box. As mentioned already, if you start with the A+O bucket, you can solve the puzzle by pulling only one fruit, Bucket: A+O Found: A Bucket A+O > A | A+O, but since A+O label is incorrect, then it must be A Bucket O > since A is taken, the new label must be O | A+O, but since O is incorrect, it must be A+O Bucket A > since A and A+O are taken, it must be O Bucket: A+O Found: O Bucket A+O > O | A+O, but since A+O label is incorrect, then it must be O Bucket A > since O is taken, the new label must be A | A+O, but since A is incorrect it must be A+O Bucket O > since O and A+O are taken, it must be A If you are lucky, you might solve it with just one fruit even if you start with other buckets, Bucket: A Found: A Bucket: A > A | A+O, but since the A label is incorrect, it must be A+O Bucket: O > A | O, but since the O label is incorrect, it must be A Bucket: A+O > since A+O and A are taken, it must be O Bucket: O Found: O Bucket: O > O | A+O, but since the O label is incorrect, it must be A+O Bucket: A > A | O, but since the A label is incorrect, it must be O Bucket: A+O > since A+O and O are taken, it must be A If you start with the A bucket and pull an O or if you start with the O bucket and pull and A, then you are SOL and you need to pull out more fruits to figure it out. 1. Open one box and check its contents. 2. Remove the current label and apply the correct one (by removing it from one of the other boxes) 3. Since all boxes have been labeled incorrectly, switch labels between the other 2 boxes. And Voila you have all the boxes labelled correctly :) In requirement already specify that all three box labels are not correct. A+O A O Step1: First Pick an item A+O Box. If you get an Apple then it is a Apple Box. swap the label . A A+O O AS we already know in the box that label with Orange, does not contain Orange because of wrong label. So It must contain A+O. Just Swap the label A O A+O OK, all 3 boxes are incorrectly labeled. Open the one that says apples and oranges. Whatever is in there is what it is (since it cannot be apples AND oranges). Now, if there was an orange in there, apples must be in the orange box (since they cannot be in the apples box), and apples and oranges in the apples box (due to process of elimination). Get it? I guess questions like these will appear easy if you put them on paper, it is the possible combinations that become relevant, one way to approach is.. One of the key factor is all boxes are labelled incorrectly, this gives rise to only (2) combinations right To label for 1st box incorrectly you will have (2) options, once you label it then you have only choice to label the other two boxes incorrectly so 2 x 1 = 2 combinations possible i.e. Incorrect lablling options { Boxes_with_Oranges, Boxes_with_Apples, Boxes_with_Apples&Oranges } = { A, AO, O} or {AO, O, A} 2. To know for sure the contents of the boxes, you need to pick the box with either Apples or Oranges and avoid box with Apples and Oranges. So from the (2) combinations you could pick a fruit from Box_labeled AO (this will contain either Oranges or Apples) So, if you get a Orange, it means that combination is{AO, O, A} , so that means Box_with_Label_O has Apples, Box_with_Label_A has Apples and Oranges Box_with_label_AO has Oranges or else if you get a Apple that combination is {A, AO, O}. Box_with_Label_AO has Apples, Box_with_Label_O has Apples and Oranges Box_with_label_A has Oranges Then you can correctly label all the 3 boxes. First answer in this post is correct, as its said all boxes doesnt reflect correct items in it, If an apple is picked from a box , then it can be from either A/O box or A box, if the box is names A/O the, the label of the box has to be changed to A, then other two box labels to be accordingly. It is interesting that in 6 years people keep overthinking this. The answer is in the question and the criteria are that the boxes are immediately labeled and they are labeled correctly. ANSWER: FRUIT FYI you don't even need to open one box. Show More Responses Your choice going to be (( 2 apple 1 orange)) or (( 2orange 1apple )) . It can be recognize only one box (x) . U have to chose again until u get another formula then u will named easly . Step 1: Open a box labeled ‘Apples and Oranges’. We know that this box does not contain ‘Mixture’ for sure. If this fruit is an apple, then label this box as ‘Apple’. Step 2: (Very important) If we look at the box labeled as ‘Oranges’, we know that since the label is incorrect, this box either has only apples in it or has Mixture. Since we already know which box contains only apples, we know that the box labeled as ‘Oranges’ contains ‘Mixture’. So label it as ‘Mixture’. Step 3: (Very easy) The 3rd box will be labeled as ‘Oranges’. When you put your hands on the box to pick the fruits by touching every fruits you can feel whether all are apple or oranges or both and just pick one to see.So it is not necessary to pick one fruit and see whether it is orange or apple also it is not said in question that you can touch and feel all the fruits inside the boxes without taking it out .and then you can fix the label correctly on the boxes. Absurd, no logic km I will took a pen and stab the apple. and then ? apple-pen. Smelling the box and writing the correct label on each. :) Just label the boxes correctly. |