Facebook London Phone Interview
Anonymous User
1636

https://leetcode.com/problems/find-words-that-can-be-formed-by-characters/
Easy - Variation of this question where you need to return the list of strings which can be constructed from a list of characters, from an array of strings.

Came up with the opimal solution and coded it successfully. Interviewer wanted me to think about edge cases but I couldn't think of any where my solution would fail. Still unsure which edge case (if any) he was trying to push me towards.

https://leetcode.com/problems/sum-root-to-leaf-numbers/
Medium - Sum of the number constructed from the root to leaf nodes.

Came up with a non optimal solution pretty quickly where I store an arraylist of the paths from root to leaf nodes via a DFS, then calculate the sum afterwards. Interviewer pushed me towards optimal solution of calculating sum during traversal.

Came up with recursive solution, updating sum based on the depth of a root to leaf. Again he pushed me towards the stack solution. I didn't manage to fully figure out the stack solution, so began coding up the solution based on the depth. Unfortunately ran out of time due to the amount of time taken to decide on the optimal solution.

Expecting reject, as I wasn't able to code up the optimal solution to the 2nd question in the allocated time. Unfortunate, but defintely a learning experience. You really gotta be on the ball and able to whack out optimal solutions straight away. The normal advice of thinking of brute force then optimising isn't a good approach with Facebook imo, as you'll run out of time.

EDIT:
Wow, so I passed and have been invited to the virtual on site. Really, really suprised. I guess that blows away my assumption that you really gotta code out the optimal solutions to both questions. I think I communicated my thought process and reasoning extremely well in the phone interview, so I think that might be what has carried me.

Comments (6)