Just got done with my first Technical screen in Meta for Menlo Park, California location. I was asked two questions:
Find the minimum element in each level of a Binary Tree. Similar to
LC102. Binary Tree Level Order Traversal, but just need to keep track of the minimum element in each level.
Follow-up: What if we have to do this in O(log n) space?
Write a Sorted List Iterator that will have the following functions:
public boolean hasNext() that would return true if a next element exists or false otherwisepublic boolean next()that will return the minimum element from a list of k sorted lists.Seemed like a mix of :
https://leetcode.com/problems/merge-k-sorted-lists/description/ - but I was given a List<List<Integer>> lists not linked lists and the question mentioned in this post: https://leetcode.com/discuss/post/352704/airbnb-iterator-over-list-of-lists-by-la-g961/