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.
Well, lets imagine that matrix is linear array divided into N equal parts where each part represents row in the matrix. Now imagine that this linear array is sorted and we try to write it to the matrix level by level. If array is sorted it means that if we write it into a matrix level by level then each row in the matrix is sorted and each column is sorted as well. This is because previous level is always closer to the beginning of array and since our array is sorted it means that every element in previous level is less then every element in the next one.
We want to avoid situation with big memory complexity. To do so we can can introduce function that acts as if it would transfered matrix to the linear array and got its ith element. something like
This is useful because using this function we are able to sort array just with any normal sort that uses index access to elements.
This function looks pretty easy actually:
using this two functions we can use some O(nlogn) sort. But since we are using O(n) get sorting this array will cost us O(n^2 logn)
- Andrey.Yaskulsky September 25, 2014