Facebook | SWE Intern | Nov 2020 | Offer
Anonymous User
785

First Interview:
https://leetcode.com/problems/design-add-and-search-words-data-structure/
Solution:
Trie data structure using recursion to insert and search words. Originally I wanted to solve the question using stack without recursion but the interviewer said that it's ok to use recursion for the purpuses of the interview.

Second Interview:
Implement a sorted iterator over k sorted lists.
Solution:
Using min heap where each node represents the current element of the corresponding list. Each node stores a tupple with 3 values: elements' value, list index, and elements' index inside the list - this allow to track the next elements.

Both Interviewers were very nice :)

Comments (1)