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.
If the index of the last element that is recently introduced into the array is unkown, then we do not know high and we cannot apply binary search just like that. So two solutions are there depending on what we have at our disposal.
- pawan.it17 September 28, 20191.Index of last element is known - in other words the size of array is known.
Check if a[lastIndex] > key
a. If so apply binary search b/w 0 to lastIndex-1.
2.Index of the last element is unknown. Then we would have to search at 2, 4, 8, 16 locations and see if we either find an index where the element is found or an index whose value is greater than the element to be found. In the former, we have the index to return. In the latter case, we would have to do binary search between last index which we checked and the current index where the number is higher than the element to be searched.