脸熟实习店面

第一轮
有点像 https://leetcode.com/problems/car-pooling/

Given number M and N intervals in the form [a, b] (inclusive) where for every interval -M <= a <= b <= M , create a program that returns a point where the maximum number of intervals overlap.

Example:

  • M: 10
  • N: 4
  • Intervals:
    • [-3, 5]
    • [0, 2]
    • [8, 10]
    • [6, 7]

A correct answer would be either 0 , 1 or 2 since those points are found where 2 intervals overlap and 2 is the maximum number of overlapping intervals.

第二轮
原题 https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes/

First one is easy level, valid palindrome question https://leetcode.com/problems/valid-palindrome-ii/
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.
I solved this question in 17 mins. They do not let you run the code so it’s important to test your code by hand line by line and talk about Big(O).

Second questions was (medium) vertical order traversal of a binary tree: https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/
I was very close to finish but there was not enough time left. I did bfs traversal on a tree and hash map to store each node.
You should take 20-30 minutes to finish implementing efficient solution to the problem.

Then after 3 days, I got rejected after I contacted my recruiter about the result. My advice to anyone interviewing with Facebook:
a) you either get 1 easy and 1 medium level question. In such cases, you should finish coding easy level question in max 15 mins and medium level in 20-30 mins.
b) or they might ask you 1 Hard question which you should solve in 35-45 mins.
c) or you might get 2 medium problems. 20-25 mins each.

先是 10-15 分钟自我介绍,问的是 deep dived in the architecture I was working on.
考了两题

  1. Alien Dictionary : https://leetcode.com/problems/alien-dictionary/ - Took me 20~25 mins.
  • With some hints got a working solution.
  • He was happy to print the results, but didn’t run the code end-to-end.
  1. Find the k-th Most frequent number.
  • I was told I have only 10 mins left and do it quickly.
  • I covered all the edge cases and got a working solution for the problem. - Interviewer was happy with it.
  • Did it in 15 minutes

后来问问题,拖到 1小时10 分钟