Meta Screening E5
Summary
I had my screening interview at Meta, during which I was asked two specific LeetCode problems: Kth Largest Element in an Array and a variation of Binary Tree Vertical Order Traversal.
Full Experience
I had my screening interview at Meta. The following questions were asked:
- https://leetcode.com/problems/kth-largest-element-in-an-array/description/
- https://leetcode.com/problems/binary-tree-vertical-order-traversal/description/ or https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/description/ with no specific order mentioned for the colliding elements (elements in the same row and column)
For the second question, when I mentioned BFS traversal, the interviewer asked why I couldn't use DFS and requested an example to prove it.
Interview Questions (2)
Kth Largest Element in an Array
Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct element. The problem expects a solution with O(n) time complexity.
Binary Tree Vertical Order Traversal
Given the root of a binary tree, return the vertical order traversal of its nodes' values (i.e., from top to bottom, column by column). The specific variant discussed did not mention a specific order for colliding elements (elements in the same row and column). I was also asked to explain why BFS traversal might be preferred over DFS for this problem and to provide an example to prove it.