Facebook | Phone | Friend Circles [Went well but got Rejected]
Anonymous User
7520

YOE: 5 yrs, Fullstack
Language: JavaScript/TypeScript, Go
Application: L3/L4 Enterprise Software Engineer (Facebook)

I just had a Facebook phone interview yesterday. I thought I killed the interview, did the solution correct. I even double checked it on Leetcode (it was 100% verbatim a Leetcode problem) by copy pasting verbatim on Leetcode and it passed on first submit. I don't know what I missed, so please help autopsy.

Here is the problem, https://leetcode.com/problems/friend-circles/

Here is my interview story:

First 5 mins, introduction from him and introduction from me. Then he said I can choose whatever language I want. I said I know Go and JavaScript but I will use Go and he said he doesn't know Go but it is ok to use it.

He proceed to paste that problem, without any changes at all, verbatim 100%. I never saw that question before, and proceed to solve it. At first, I thought it was the same as "Number of Islands", and did the solution for that problem instead (5 mins). Then I tried to run the test case by running manually on paper one by one (5 mins), and I realized oh it was the wrong solution. This took total around 10 mins, and I proceed to fix it for another 5 mins. I then test it by running manually on paper one by one, this one took longer, maybe around 10 mins because the interviewer seemed not to get what I said. He had a thick Chinese accent. But I tried to explain and he said ok that's fine.

Then he asked about Time and Space complexity, which I said where N is the number of people, then Space complexity is O(N + N) => O(N), where the first N is for a visited hashmap and the second N is for friends array. Time complexity is N^2. He said "why N^2?", I said, because N is defined as the number of people, so we have to visit each node, so it means N^2. As an example, the number of people is 3, but the friends matrix has 9 cell in total, so it is N^2. In the end he said "ok I understand"

Here is my solution
func solve(graph [][]int) int {
	if len(graph) == 0 {
		return 0
	}

	visited := map[int]bool{}
	circleOfFriends := 0

	for f := 0; f < len(graph); f++ {
		if !visited[f] {
			visit(graph, f, visited)
			circleOfFriends += 1
		}
	}

	return circleOfFriends
}

func visit(graph [][]int, p int, visited map[int]bool) {
	if visited[p] {
		return
	}

	visited[p] = true

	for _, f := range getFriends(graph, p) {
		if !visited[f] {
			visit(graph, f, visited)
		}
	}
}

func getFriends(graph [][]int, p int) []int {
	friends := []int{}

	for f := 0; f < len(graph[p]); f++ {
		if graph[p][f] == 1 && p != f {
			friends = append(friends, f)
		}
	}

	return friends
}

After this question is finished he said "that's it, do you have any other question for me?" then I proceed to ask these questions:

  • What is your team size, do you have PM, etc?
  • What is the stack?
  • Do you do sprint biweekly?
  • What do you like about working at FB?

After that it is over.

After the interview is over I proceed to Leetcode and see if there is a similar question, and it turned out to be the Friend Circles question. So I copied my solution verbatim 100% without changing anything (other than the function name of course) and let Leetcode run it, and it passed on first submit.

So I thought my interview went really well.

But today I got the rejection email, saying "after carefully reviewing your technical phone screen we decided not to move forward". I felt so disappointed. I replied asking for feedback, but I'm sure they will not give any,

So here I am, trying to ask from wisdom from the community, what was missing from me during the interview?

Thank you

EDIT:

I decided to contact the recruiter about the reason. I confirmed that it was a requirement that I should answer 2 questions to pass the phone interview. What sucked about it was that I still had 15 mins left and the interviewer decided not to ask the 2nd question. I heard that they probably have a protocol that strict one question to an X amount of minutes, hence that's why the person decided not to ask the questions.

Anyway, it is confirmed why, so I apologize for this thread. It was not my intention to bring flame wars regarding accent/race. I was a little bit disappointed that I need to explain my reasonings quite a number of times due to the interviewer couldn't understand me. I only described my experience as honest as possible.

Comments (15)