Google Interview Question
1,223 Interview Reviews |
Back to all Google Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineer - New Grad at Google:
Given a list of integers of at least length 7, print the average of each consecutive 7 number long subsequence (sliding window).
See more for this Google Software Engineer - New Grad Interview
Helpful Question?
Yes |
No
Inappropriate?
0 of 0 people found this helpful
by Luc:
int total = 0;
for (int i = 0; i <= vals.length; i++) {
if (i >= everyN) {
System.out.printf("%f\n", (double)total/(double)everyN);
total -= vals[i-everyN];
}
if (i < vals.length)
total += vals[i];
}
}