Facebook Interview Questions
- 0of 0 votes
AnswersQuestion 1: Given an input of an array of string, verify if, turned 180 degrees, it is the "same".
- mche1987 March 27, 2018 in United States
For instance:
[1, 6, 0, 9, 1] => return true
[1, 7, 1] => return false| Report Duplicate | Flag | PURGE
Facebook SDE1 Algorithm - 2of 2 votes
AnswersMarch 2018 Phone Interview FB
- aonecoding March 17, 2018 in United States
Calculate a moving average that considers the last N values.
Circular Queue (Interviewer didn't agree with the linked list queue that I suggested at first. Said the pointers took space)| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 5of 5 votes
AnswerWhy facebook?
- androidenthusiast March 12, 2018 in United States
What was the biggest technical problem that you solved?
Do you have any apps on google play?
Give me a scenario where the requirements were ambiguous, what did you do?| Report Duplicate | Flag | PURGE
Facebook Android Engineer Behavioral - 0of 0 votes
AnswersDesign Instagram like app end to end
- androidenthusiast March 12, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Android Engineer design - 0of 0 votes
AnswersGiven a string "L*&EVe)))l", write a method which will determine if the input is a palindrome. Ignore all special characters. Uppercase/lowercase should be considered as same.
- androidenthusiast March 12, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Android Engineer Java - 0of 0 votes
AnswersImagine a room full of people, with only 1 celebrity in the room. Celebrity is defined as a person who does not know anyone, but everyone knows him/her. Write a method who will take array of people and a person as input and return boolean if the person is a celebrity or not.
- androidenthusiast March 12, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Android Engineer Java - 0of 0 votes
AnswersGiven two input arrays, return true if the words array is sorted according to the ordering array
- releb February 28, 2018 in United States
Input:
words = ['cc', 'cb', 'bb', 'ac']
ordering = ['c', 'b', 'a']
Output: True
Input:
words = ['cc', 'cb', 'bb', 'ac']
ordering = ['b', 'c', 'a']
Output: False| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 2of 2 votes
AnswersGive the following input, output if the array is sorted according to the ordering array given. Return true or false.
- releb February 28, 2018 in United States
Input:
words = ['cc', 'cb', 'bb', 'ac']
ordering = ['c', 'b', 'a']
Output: True
Input:
words = ['cc', 'cb', 'bb', 'ac']
[bb cb cc ac]
ordering = ['b', 'c', 'a']
Output: False| Report Duplicate | Flag | PURGE
Facebook Software Engineer - -1of 1 vote
AnswersDefine a class 'Space' which has a member string variable that indicates if the space is a "tree", a "house" or an empty space and another member variable that will store the 'space neighbors' (left, right, up and down only)
- d4niel February 27, 2018 in United States
Given a 'Grid' (list) of Spaces write the code for the findAll(start) method to find all the trees and houses given a 'Space' as start point
Example, Grid of 'Spaces':
T 0 0 H 0
0 0 0 0 0
H H T H 0
Where Ts are trees and Hs are houses| Report Duplicate | Flag | PURGE
Facebook Software Engineer Trees and Graphs - 0of 0 votes
Answers# Given a dictionary, find all pairs of words that,
- nico.campolongo February 16, 2018
# when concatenated together, form a palindrome.
# ‘none', 'xenon': 'nonexenon' is a palindrome
# 'none', 'xexenon': 'nonexexenon' is a palindrome| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern - 3of 3 votes
AnswerHow would you work with a backend engineer to design a news feed on mobile. Imagine that we only care about showing the user feed and posting a picture.
- tbag February 15, 2018 in United States
Follow-ups
1. what kind of apis would you want him to expose and what would they look like
2. How would you refresh the news feed on the iOS app and how often?
3. How would you cache the data/images. What size cache would you have?| Report Duplicate | Flag | PURGE
Facebook iOS Developer System Design - 1of 1 vote
AnswersGiven an aray with ['a1', 'a2', .....'aN', 'b1', 'b2', ....'bN', 'c1', 'c2', .....'cN'],
- ajay.raj February 10, 2018 in United States
stagger the subarrays so it becomes ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', ...'aN', 'bN', 'cN']. The optimal solution requires linear-time
sorting and a constant space complexity.| Report Duplicate | Flag | PURGE
Facebook Java Developer - 0of 0 votes
AnswerHow to design a spreadsheet program? How do you know to update a field after another
- ajay.raj February 10, 2018 in United States
field was changed that it depended on?| Report Duplicate | Flag | PURGE
Facebook Java Developer - 0of 0 votes
AnswersGiven a set of points in the 2D coordinate system, find the radius of the
- ajay.raj February 10, 2018 in United States
smallest circle which encompasses
all the given points| Report Duplicate | Flag | PURGE
Facebook Java Developer - 0of 0 votes
AnswersTry to come up with a combination of two data structures to implement a
- ajay.raj February 10, 2018 in United States
data structure that supports search,
delete in O(1) time and insert in O(n) time.Try to come up with a combination of two data structures to implement a
data structure that supports search,
delete in O(1) time and insert in O(n) time.| Report Duplicate | Flag | PURGE
Facebook Java Developer - 0of 2 votes
AnswersWrite a program to print all the columns of a binary tree from left to right and top down.
- mvatankh@stevens.edu February 07, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Data Scientist - 0of 0 votes
AnswersGiven list of strings like “ crane, drain, refrain” and a pattern such as *an*
- tushr1388 February 05, 2018 in United States
where * can match any number of chracters.
Return the matching word in an efficient manner.
Answer to above question : crane| Report Duplicate | Flag | PURGE
Facebook SDE1 Java - -1of 1 vote
AnswersGiven a MxN matrix where each element can either be 0 or 1. We need to print the shortest path between a given source cell to a destination cell. The path can only be created out of a cell if its value is 1.
- ajay.raj January 15, 2018 in United States
BFS is trival, please solve it use DFS
public void print(int[][] matrix, int[] start, int[] end){
}| Report Duplicate | Flag | PURGE
Facebook SDE1 - -5of 9 votes
AnswersWarning! User majia168 is posting fake interview questions!
- dummy020614 January 09, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersGiven a non-empty string s, you may delete at most k characters. Judge whether you can make it a palindrome.
- ajay.raj January 05, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersGiven a list of input tasks to run, and the cooldown interval, output the minimum number of time slots required to run them.
- ttemp3103 December 31, 2017 in United States
// Tasks: 1, 1, 2, 1, 2
// Recovery interval (cooldown): 2
// Output: 8 (order is 1 _ _ 1 2 _ 1 2 )
Whats the time and space complexity ? What's the ideal case of space complexity ?| Report Duplicate | Flag | PURGE
Facebook - 0of 0 votes
AnswersFind the maximum sum of subset of size K in an array
- ajay.raj December 16, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Developer Program Engineer - 0of 0 votes
AnswersGiven an array (may have negative num) and an integer(may be negative), find the smallest subarray whose sum is >= the given integer.
- ajay.raj December 16, 2017 in United States
int[] nums2 = {5,4,-8,16};
int x=10;
return 1, because 16 >= x
try to solve it in o(n) time
public static int miniSubArrayLen(int[] nums, int s) {| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersGiven a List determine if contiguous elements of the List sum to an input number. For example: Array/List [6 5 3 2 1 7], and input number 8. The numbers 5 + 3 = 8. Or suppose an input number 10, the elements of the list 2 + 1 + 7 = 10.
- william.watts December 12, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Senior Software Development Engineer Algorithm - 0of 0 votes
Answersfind LCA in directed acyclic graph
- ajay.raj December 10, 2017 in United States
class Node {
int label;
List<Node> neighbors;
Node(int x) {
label = x;
neighbors = new ArrayList<>();
}
}
public List<Node> findLCAINDAG(Node, graph, Node n1, Node n2)| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersSay you have an array for which the ith element is the price of a given stock on day i, you can buy stock at any day, but can only buy once a day, but if you sell the stock, you must sell all of them at once.
- ajay.raj December 02, 2017 in United States
Seeking maximum profit
public int maxProfit(int[] prices) {| Report Duplicate | Flag | PURGE
Facebook Java Developer - 0of 0 votes
AnswersGiven a binary tree, print the path that has the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path must contain at least one node and does not need to go through the root. the node val may be negative one
- ajay.raj December 02, 2017 in United StatesFor example: Given the below binary tree, 1 / \ 2 3 Return 2-1-3. -1 / \ -2 3 \ -1 Return 3. public List<Integer> findMaxPath(TreeNode root){ } /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */
| Report Duplicate | Flag | PURGE
Facebook Backend Developer - 0of 0 votes
Answersfind the longest substring with at most k repeating characters,
- ajay.raj November 27, 2017 in United States
to make it more clear, at most k repeating characters means in the substring, the max count(frequency) of one or more chars is k| Report Duplicate | Flag | PURGE
Facebook Java Developer - 0of 0 votes
AnswersRobot walked from the upper left to the lower right, can only go down and to the right, the number of each grid is height,
- ajay.raj November 25, 2017 in United States
If the next cell height is higher than the current, we must pay the difference cost, otherwise no cost,
Find the minimum cost to reach the lower right corner,
Follow up 1, print the minimum cost path;| Report Duplicate | Flag | PURGE
Facebook SDE1