Facebook Interview Questions
- 0of 0 votes
Answersnumber_one = "193283492420348904832902348908239048823480823"
- shopatlemo July 01, 2017 in United States
number_two = "3248234890238902348823940990234"
Question:
1) I need to multiply this and get the answer
2) DO NOT CONVERT TO INT AND DO THE MULTIPLICATION| Report Duplicate | Flag | PURGE
Facebook Data Engineer Python - 0of 0 votes
AnswersI have two tables
- shopatlemo July 01, 2017 in United States
Supplier Table:
Supp_id
supp_name
Invoice Table:
inv_id
supp_id
inv_date
inv_amt
payment_date
paid_amt
I want to list the invoice(s) that have highest invoice_amt for the year 2016.
DO NOT USE MIN/MAX function| Report Duplicate | Flag | PURGE
Facebook Data Engineer SQL - 0of 0 votes
AnswerMake 100 HTTP GET requests to http://en.wikipedia.org/wiki/Main_Page and print the following statistics for the response time to stdout:
- Pedro June 24, 2017 in United States
• 10th, 50th, 90th, 95th, 99th Percentile
• Mean
• Standard Deviation
Your solution must be parallel. You must make at least N (say 10, but should be configurable). Use ExecutorService in Java for making the requests at a time.
Explain design choices, known limitations and edge cases.
What challenges did you face? How would you improve the code if you had more time?| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer - 0of 0 votes
AnswersGive you an unsorted integer iterator
- ajay.raj June 17, 2017 in United States
and a percentage that is expressed in double (for example, 0.4 for 40%),
and find the number of the sorted array at the percentage position.
Example: Enter [1 3 2 5 4 6 7 9 8 10], and 0.6, you will return 6
public int findNumber(Iterator<Integer> nums, double percent){
}| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
Answerscan you use union find to Detect Cycle in a Directed Graph? why or why not
- ajay.raj June 14, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
Answerhow to design github
- ajay.raj June 11, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersReturn the most popular 10 words in the past 24 hours for twitter
- ajay.raj June 09, 2017 in United States
Follow up in order to reduce the size of each log, do not write timestamp, how to get the same answer,| Report Duplicate | Flag | PURGE
Facebook SDE1 - 3of 3 votes
AnswersFind out if the given string forms a valid lottery number.
- AnonD June 09, 2017 in United States
- A valid lottery number contains 7 unique digits between 1 and 59.
e.g.
4938532894754 (yes) -> 49 38 53 28 9 47 54
1634616512 (yes) -> 1 6 34 6 16 51 2
1122334 (no)| Report Duplicate | Flag | PURGE
Facebook Software Developer - 0of 0 votes
AnswersGiven a Calendar class (there are three fields, year, month, day) and a number of N,
- ajay.raj June 08, 2017 in United States
Implement a function that returns the calendar after N days,
For example, if the input is {2017, 3,20} and 12, then the return is {2017,4, 1}| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
Answersimplement a Fibonacci iterator
- ajay.raj June 08, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook SDE1 - -1of 1 vote
AnswersNow we have one server, one database, what if response time is slow?
- ajay.raj June 08, 2017 in United States
How to optimize?| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersGiven an integer n, count the total number of digit 3 appearing in all non-negative integers less than or equal to n.
- ajay.raj June 08, 2017 in United States
(E.x: given 30, return 4 {3,13, 23, 30})| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
Answersprime factors. given a number return the prime factor multiplication.
- ajay.raj June 08, 2017 in United States
eg. 90 = 2 * 3 * 3 * 5.| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersRemove any number containing 9 like 9, 19, 29, ... 91, 92, ... 99, 109...
- ajay.raj June 08, 2017 in United States
Write a function that returns the nth number. E.g. newNumber(1) = 1
newNumber(8) = 8, newNumber(9) = 10| Report Duplicate | Flag | PURGE
Facebook SDE1 - 2of 2 votes
AnswersGiven a n*m size 2D array with integers from 1 to n*m - 1 in it.
- ajay.raj June 08, 2017 in United States
Integers are not sorted. The last position of the matrix stays a movable block.
For each time, you can swap the movable block with any adjacent number.
And eventually you will have the integers sorted and the movable block returned
to its starting position. Think about an approach to print the path.
(You can assume it always have at least a solution)| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
AnswersHow to get the repeating decimal pattern of a division? (e.g 1/3, 1/6)
- ajay.raj June 08, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 1of 1 vote
AnswersGiven a preorder traversal of a BST, print out the inorder transversal of the BST
- ajay.raj June 06, 2017 in United States
public void printInorder(int[] nums){}| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 1of 1 vote
AnswersImplement circular buffer with read & write functions
- aonecoding June 06, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Data Structures - 1of 1 vote
AnswersCoding III
- aonecoding June 06, 2017 in United States
Implement int divide(int a, int b) without division or mod operation.
## Round IV
Behavioral Questions + Project Walk Through + Coding (Validate BST)
## System Design V
Design memcache to enable read, write and delete (single server, non-distributed infrastructure).
Which data structure to go with?
Eviction rules?
How to minimize segmentation?
How to handle concurrency?
## Extra
After two weeks they called me to an extra round of system design.
How to store social graphs?
How to handle concurrent read/write requests(read heavy) on one server.| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 2of 2 votes
AnswersFind Famous person in the list of persons.
- Seeker June 01, 2017 in United States
A person is a famous person if he doesn't know anyone in the list and everyone else in the list should know this person.
The function isKnow(i,j) => true/ false is given to us. No need to worry about it.
Goal is to find the famous person in O(n) complexity.| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 0of 0 votes
Answers/* Find all subsets of size k in an array that sum up to target
- ajay.raj May 31, 2017 in United States
the array may contains negative number */
class Solution {
public List<List<Integer>> combinationSum(int[] nums, int target, int k) {
}| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswersA bot is an id that visit the site m times in the last n seconds,
given a list of logs with id and time sorted by time, return all the bots's id
- ajay.raj May 31, 2017 in United Statesclass Log{ String id; int time; } public HashSet<String> getBots(Log[] logs, int m, int n){ }
| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
Answersdownload all urls from 1000 hosts. Imagine all the urls are graph.
- ajay.raj May 28, 2017 in United States
Requirement: Each host has bad internet connection among each other, Has to download url exacly once.| Report Duplicate | Flag | PURGE
Facebook SDE1 - 0of 0 votes
AnswerGive you a robot and a room where you do not know where the robot is in the room and you do not know the size of the room, you have a remote control that allows the robot to walk around four directions. Here you give a move method: boolean move (int direction), direction: 0,1,2,3 that four directions. If it can move in that direction, return true, and if it cannot move in that direction, return false. Ask you determine how big this room is. the shape of the room can be any shape, so you cannot assume it is rectangle or square.
- ajay.raj May 26, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook SDE1 - 1of 1 vote
AnswersGiven a 2D character array of size NxN. Find if there is a path from the cell 'R' to the cell 'T'. You can go left, right, up, down from a cell and you cannot pass through any cell marked with 'X'.
- Thor May 25, 2017 in United States
Example input:
X__R_X
X_XXX_
______
_XX_XX
XT__X_
Output: true| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
AnswersPrint all permutations of a given string.
- Thor May 25, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 1of 1 vote
AnswersThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].
- majia168 May 23, 2017 in United States
You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You can begin the journey with an empty tank at one of the gas stations.
Return ALL the starting gas station's index where you can travel around the circuit once
public List<Integer> canCompleteCircuit(int[] gas, int[] cost) {
}| Report Duplicate | Flag | PURGE
Facebook SDE1 - 1of 1 vote
AnswersYou have a array with integers:
[ 1, -2, 0, 6, 2, -4, 6, 6 ]
You need to write a function which will evenly return indexes of a max value in the array.
- vu-doo-cok May 22, 2017 in UK
In the example below max value is 6, and its positions are 3, 6 and 7. So each run function should return random index from the set.
Try to implement with O(n) for computation and memory.
Try to reduce memory complexity to O(1).| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 0of 0 votes
AnswersYou have a binary tree which consists of 0 or 1 in the way, that each node value is a LOGICAL AND between its children:
0 / \ 0 1 / \ / \ 0 1 1 1
You need to write a code, which will invert given LEAF and put tree in a correct state.
- vu-doo-cok May 22, 2017 in UK| Report Duplicate | Flag | PURGE
Facebook Software Engineer Data Structures - 0of 0 votes
AnswersGiven n1, n2 is the number after removing one digit from n1. Example, n1 = 123, then n2 can be 12, 13 or 23.
- ajay.raj May 22, 2017 in United States
If we know the sum of n1 + n2, and find the possible values of n1 and n2.
public List<List<Integer>> getNumber(int sum){
}| Report Duplicate | Flag | PURGE
Facebook SDE1