Meta E4 Phone Screen (+ Mock)
Company: Meta
Role: E4
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
Mock Interview
1. Move Zeroes
2. 3Sum
Real Phone Screen
1. You are given an API readNext() which gives you the next (positive) number in a stream. The end of the stream is indicated by a -1. Return the Kth smallest element in this stream.
Example: [2, 3, 5, 4, 6, 7, 9, 11, 2, 3 ... -1], k = 3. The method should return 4.
2. You are given a binary tree and an integer k. Return true if there is a pair of numbers in the binary tree that add up to this k, false otherwise. However, the pair of numbers must be on different levels in the tree.
Example:
12
/ \
2 8
/ \ / \
3 0 4 9
/ / \
0 3 6
k = 9
Return true, because there is a pair that satisifes the constraints