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.
Complexities are
- sonesh April 24, 2017Add Candidate: O(1)
Add Vote: O(1)
Delete Candidate: O(1)
GetWinner : O(N), N is total candidate count // least used
GetCandidateVoteCount : O(1)
GetTotalVoteCount : O(N), can be made O(1) easily. It is scalable, can store data into the database and while we restart the machine, it can read data from the DB and initialize itself. We can very well optimize GetWinner call as well, to return output in O(1) time. To do that, we have to store, the candidate vote count in a LinkedList and in the dictionary, we will store candidate information and corresponding LinkedList node for the vote count. We will also store maxVoteCount variable outside of all these, and when the current candidate vote count become more then maxVoteCount, then we update maxVoteCount and put that node in the first of the LinkedList. By this way, we will be able to answer GetWinner as well in O(1), just that insert and delete will take more time not in terms of complexity but in terms of more computer operations.
Failure conditions are all taken care of.