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.
We can use LRU cache. I would use a 2 maps and 1 queue. The queue would be of size 100 and hold all the worker objects. The first map would have key -> unitId and value -> a list which stores the starting address of the first worker object in the queue and second value in the list would be the number of worker objects for same unitId.
- nikanjgupta April 16, 2016Second Map : key -> deptId, value -> starting address and number of worker objects for that id.
If map contains the key then access the queue and iterate for n elements (say n is number of worker objects for that id). If all objects are present done else query the server get all objects and update the cache.
How to update the cache/queue : If a hit is found the return the worker objects then move all the worker objects which matched to start of the queue and update the address in the map. So in case we query for some id not in the queue/cache then we can add those new objects to start of the queue and remove equal number of objects from end of the queue since they were least recently used.