Meta | Phone Screen| MLE | Remote
Anonymous User
2577

I had a Meta phone screen about a week ago.

35 mins, 2 questions:

  1. Write a function to generate something similar to n-grams. Input: ['a','b','c','d','e'] and N=3 and Output = [['a','b','c'],['b','c','d'],['c','d','e']].
  2. Follow up that was more complex: ['a','b','c','d','e'] , N=3 and skip=1 and Output = [['a','b','c'],['a','b','d'],['a','b','e'],['b','c','d'],['b','c','e'],['c','d','e']]

Edit: First problem is asking for sub-lists with consecutive elements of length N. In the follow-up, skip means that we skip few elements to get more permutations. So, if skip=1 then after 'a', 'b' we goto 'd' i.e., skip 'c'; similarly after 'a' we could skip 'b' and goto 'c' and 'd'.

Not sure if these are leetcode problems. I solved the first but ran out of time for follow-up. Not moving to next round.

Comments (10)