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.
My Approach :
- himanshukumar660 September 27, 20181. Copy the array into two arrays, say A and B.
2. Make a min Heap of A by the cost of moving the candidate to NY and a Min heap B by the cost of moving the candidate to SF.
3. Now compare the top of each min Heap A and B.
3 a. If the cost is same, take pop entry from both A and B and add the entry to the total cost
3 b. if the cost in A is less than that of B, pop the A top entry from both the min Heap A and B and add the entry to the total cost
3 c. if the cost of B is less that that of A, pop the B top entry from both the min Heap A and B and add the entry to the total cost.
4. if you remove a entry from A, increment conut_NY by 1 and count_SF by 1. When any one of them becomes 50, proceed by removing the rest elements from the other min Heap
5. When the count of both of them become 50, return the total cost.