is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
There are two important points to note here:
- asimprakash June 28, 20131. Focus is on "fastest retrieval of unique user count"
2. The query can come in at anytime and not fixed 10 minute intervals.
We can solve it by using a Hash-table with min-heap. The hashtable uses userid as key and stores last logged in time. The min-heap uses last logged in timestamp as key. Every node in min-heap is pointed to by an element in hashtable with corresponding userid.
Everytime a user logs in:
1. Extract-min from min heap while timestamp at root is more than 10 mins older.
2. Update the timestamp in hashtable for given userid.
3. If the element in hashtable does no point to any node in min-heap,
3.a. Insert a node to min-heap with key as new timestamp and point hashtable element to this node.
ELSE
3.b. update timestamp of the pointed min-heap node and min-heapify at this node.
Everytime user count is required:
1. Extract-min from min heap while timestamp at root is more than 10 mins older.
2. Return heap-size.