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.
Here is my take... not quite sure if I have it right.
- ssorower December 08, 2014Given the input integer array, compute the median of the values. Then start working at the location of the median in the array - adjust all the elements forward and backward by adjusting them to be within target.
Step 1: compute the median m and it's position pos
Step 2: start at (pos+1) up to A.length,
if A[pos+1] is already within distance target from A[pos], do nothing
else
{
adjust A[pos+1] by increasing or decreasing it and pick the one which makes it within distance target from A[pos]
if both increasing and decreasing gives acceptable solution, look at A[pos+1] to decide which one to pick
}
Step 3: start at (pos-1) up to 0,
do similar as Step 2.
Example (borrowed from Gambler):5 19 18 0 2
Step 1: median = 5, pos = 0
Step 2: adjust forward 5 6 7 6 5
Step 3: do not need for this particular example.