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.
Use the following data structure:
N is the number of prisoners and V is the average number of friends for each prisoner.
- rrahmati February 04, 2015To update the danger value of a prisoner, we need to update danger rank of its friends which takes O(V^2).
To find the most dangerous prisoner we iterate through the prisoner's list and retrieve the maximum which can be done in O(N).
Another solution is to sort the prisoners list by their danger rank. In this case, update is O(V*log(n) + V^2). Finding the most dangerous prisoner is O(1).