Mock Interview
Real Phone Screen
- 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.
- You are given a binary tree and an integer
k. Returntrueif there is a pair of numbers in the binary tree that add up to thisk,falseotherwise. 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 constraintsComments (11)


