Google Interview Question
1,220 Interview Reviews |
Back to all Google Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Developer at Google:
1) Code and analyse the function findMaximums(). 2) Use a sorted data structure (a binary tree). 3) std::vector<int> findMaximums(int* Data, int N, int K) where 4) Data is an array of int's. 5) N is the size of the array Data. 6) K is the number of element from Data you want to compare and maximize. 7) The vector you return is the list of these "local maximums".
| Tags: | easy See more , See less 8 |
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (2)
{
std::vector<int> list;
qsort(Data, n, sizeof(int), compare);
for (int i = N ; i--; i>0)
{
if (Data[i]>K)
list.push_back(Data[i]);
else
break;
}
return list;
}
Helpful Answer?
Yes |
No
Inappropriate?
To comment on this
question,
Sign In with Facebook or
Sign Up
by ✳✳✳✳✳✳✳✳