# Facebook’s toughest interview questions revealed. Can you answer them?

A career at Facebook is one of the most coveted opportunities in Silicon Valley. The job interviews at the social-media behemoth are notorious for their novelty, quirkiness and outright strange questions. Here are 10 of the toughest and strangest questions potential programmers get asked – how many can you tackle?

1. “Write a C function (computer code language) to define strstr (char *haystack, char * needle) to return the first occurrence of needle in haystack.”

2. “Pick up a coin C1 given C1+C2 with probability of trials p(h1)=.7, p(h2)=.6 and doing 10 trials. What is the probability that the given coin you picked is C1 given you have 7 heads and 3 tails?”

3. “You have two light bulbs and a 100-story building. You want to find the floor at which the bulbs will break when dropped. Find the floor using the least number of drops.”

4. “You’re about to get on a plane to Seattle. You want to know if you should bring an umbrella. You call 3 random friends of yours who live there and ask each independently if it’s raining. Each of your friends has a 2/3 chance of telling you the truth and a 1/3 chance of messing with you by lying. All 3 friends tell you that ‘yes’ it is raining. What is the probability that it’s actually raining in Seattle?”

5. “You are trying to rob houses on a street. Each house has some cash. Your goal is to rob houses such that you maximize the total robbed amount. There’s a catch – once a house has been robbed the two houses nextdoor can’t be broken into.”

6. “How would you measure/calculate the rate of rehabilitation in Irish prisons?”

7. “When and how Facebook will reach 2 billion users?”

(The point to this one is to figure out an algorithm that can predict how numbers will increase.)

8. “A professor wants to see if two students have cheated when writing a paper. Design a function hasCheated (String s1,String s2, int N) that evaluates to true if two strings have a common substring of length N.”

9. “25 racehorses, no stopwatch. 5 tracks. Figure out the top three fastest horses in the fewest number of races.”

10. “Do you always dress like that?”

This one was reported by an angry applicant who arrived at Facebook’s headquarters in business attire, going based on advice on Facebook’s corporate website.