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.
This successfully identifies the most left index of 4. I also did several test like:
- biscayne3 September 15, 2014{ 4, 4, 4, 4, 5, 6, 1, 2, 3, 4, 4} and
{ 0, 3, 4, 4, 5, 6, 1, 2, 3, 4, 4} and it also works. I hope it helps.
int main(){
int num[] = { 1, 4, 4, 4, 5, 6, 1, 2, 3, 4, 4};
int index = -1;
indexOf(4,num,0, 11, index);
cout << index << endl;
return 0;
}
void indexOf(int num, int numList[], int start, int end, int& posIndex ){
print(end-start, numList);
// Base case
if ( start > end)
return;
// Get middle
int mid = (end - start)/2;
if ( numList[mid] == num){
posIndex = mid;
}
// Special Case
else if (mid == 0 && numList[mid+1]==num){
posIndex = mid+1;
}
// Check if it is on the right
if ( numList[mid] > num && num <= numList[end]){
indexOf(num, numList, mid + 1, end, posIndex);
}
else{
// Else go to the left
indexOf(num, numList, start, mid-1, posIndex);
}
}