No offer. I will not say what is from the phone screen and what is from the onsite.
You get 1 behavioral question for each round (including the phone screen) and the rest is coding or system design.
Behavioral questions:
Tell me about a time where you took a risk on a new product.
Tell me about a time where you were the first to take action on something.
Tell me about a time where you had a disagreement with someone and how you resolved it.
Tell me about a time where you built something as a result of a customer request or improved something for a customer.
Talk about a project that I'm proud of.
Technical knowledge:
For the coding questions, please google "1point3acres Snap" (use Chrome to read Chinese) to see the other questions that Snap likes to ask.
Coding questions:
Problem 1
Custom:
Given an R x C grid of letters "P", "F", and ".", you have one person "P" and his friends "F".
The person will go visit all his friends and can walk over the empty spaces to visit his friends.
He visits a friend when he walks onto the friend's square.
He can walk over his friends.
Find the length of the shortest path for him to visit all his friends.
"..P..",
"F...F",
"FF.FF"
The answer is 9.
This is a graph problem. You need to compute the distance between each person or friend, then find the size of the minimum spanning tree. Use a union find.Problem 2
You are using a browser to visit web pages.
e.g. page1 -> page2 -> page3 -> page4 -> page5 (single thread page view)
This gives a list like so:
[
[page1, page2],
[page2, page3],
[page3, page4],
[page4, page5],
]
Now we shuffle the list:
[
[page2, page3],
[page1, page2],
[page4, page5],
[page3, page4],
]
Return a pair of strings indicating the first and last page you visited:
["page1", "page2"]
FOLLOW UP:
There are some cases where you cannot determine what page you started with:
page1 -> page2 -> page3 -> page4 -> page5 -> page1
You could start at any of the pages
But there are also cases where you can determine where you started
page1 -> page2 -> page3 -> page4 -> page5 -> page1 -> page5 (single thread page view)
Input:
[
[page3, page4],
[page4, page5],
[page1, page2],
[page2, page3],
[page5, page1],
[page1, page5],
]
The only possible answer is ["page1", "page5"] (because the indegree of page 1 < outdegree of page1)
(and the indegree of page 2 >= outdegree of page 2)
Handle this case as wellProblem 3:
You are given a n x n array of integers where each position contains a 1 or 0.
1 represents land and 0 represents water.
You walk from the top of the input to the bottom using the shortest land path.
You can move up, down, left or right (no diagonal movements).
Modify the array so that every cell not on the shortest land path is water.
"""
input = [
[1,0,0,1,0],
[1,1,1,1,0],
[1,0,1,0,0],
[0,1,1,0,1],
[0,1,0,0,0]
]
output = [
[0,0,0,1,0],
[0,0,1,1,0],
[0,0,1,0,0],
[0,1,1,0,0],
[0,1,0,0,0]
]
Follow up:
Part 2: Now you are given a 2D array of integersSt where each position contains 0-9.
The number 0 still represents water and values 1-9 represent the cost of
traversing that piece of land. Return an array containing the land used in the
lowest cost path.
E.g.
# int[][] input = {
# {2,0,0,1,0},
# {2,0,1,1,0},
# {2,0,1,0,0},
# {2,0,1,1,1},
# {2,0,0,2,0}
# };
int[][] output = {
{0,0,0,1,0},
{0,0,1,1,0},
{0,0,1,0,0},
{0,0,1,1,0},
{0,0,0,2,0}
};
This is the lowest cost path (cost = 8).Problem 4:
Course-Schedule-ii.
Follow-up: Do it with a post order traversal, then show all possible ways to take the courses.