Facebook Interview Questions | Glassdoor

Companies matching "Facebook"

Facebook Interviews

www.facebook.com /  HQ: Menlo Park, CA

3,527 Interviews

3.1 Average

PRO Unlimited Interviews

www.prounlimited.com /  HQ: Boca Raton, FL

62 Interviews

2.9 Average

Nexo (TX) Interviews

www.nexorevolution.com /  HQ: San Antonio

0 Interviews

Not Yet Rated

Facebook Interview Questions

Sort: RelevancePopular Date

Write some pseudo code to raise a number to a power.

11 Answers

pretty trivial...

int raise(num, power){ if(power==0) return 1; if(power==1) return num; return(raise(num, power-1)*num); }

double Power(int x, int y) { double ret = 1; double power = x; while (y > 0) { if (y & 1) { ret *= power; } power *= power; y >>= 1; } return ret; }

Suppose you have a matrix of numbers. How can you easily compute the sum of any rectangle (i.e. a range [row_start, row_end, col_start, col_end]) of those numbers? How would you code this?

6 Answers

If you were handed 50 new target accounts how would you start?

1 Answer

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?

33 Answers

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 Answers

Implement a function rotateArray(vector<int> arr, int r) which rotates the array by r places. Eg 1 2 3 4 5 on being rotated by 2 gives 4 5 1 2 3.

18 Answers

Given a list of n objects, write a function that outputs the minimum set of numbers that sum to at least K. FOLLOW UP: can you beat O(n ln n)?

15 Answers

You are trying to rob houses on a street. Each house has some +ve amount of cash. Your goal is to rob houses such that you maximize the total robbed amount. The constraint is once you rob a house you cannot rob a house adjascent to that house.

13 Answers

Implement a function string balanceParanthesis(string s); which given a string s consisting of some parenthesis returns a string s1 in which parenthesis are balanced and differences between s and s1 are minimum. Eg - "(ab(xy)u)2)" -> "(ab(xy)u)2" ")))(((" -> ""

13 Answers

Given an array of integers, now we want to erase all 0's (can be other value), and we want the result array condensed, meaning no empty cell in the array.

16 Answers
110 of 2,624 Interview Questions