Shopee Interview Question

1.tree traversal. 2. kth largest element in an array.

Interview Answers

Anonymous

Mar 24, 2020

Kth largest is simple 1. Create a priority queue(min-heap) 2. Insert 0-K elements from array in the heap 3. Insert the remaining elements also, but before every offer(), do a poll(). 4. Peek() the queue. That's your kth largest.

1

Anonymous

Feb 21, 2020

Just remember to figure out how to get the input first. The online console is not functioning well, I ended up wasting time trying to debug a simple print() for most of the time.