2026 Google interns(SWE) interview process is slightly different from previous years, but the core examination point still centers around algorithms, data structures and communication skills. Below are two typical VO interview questions, including a description of the problem, clarifying questions, solutions and sample code.

Q1: Find the length of the shortest queue
Problem description
Given a number of programs that can only be called pop() And empty() of queues, find the shortest queue length among them.
Clarify
- Queue elements are repeatable.
pop()Returns and removes the head element of the queue.- once (sth. happens, then...)
empty()is true, the queue is considered complete.
Ideas
- Maintains the current length and completion status of each queue.
- loop for all unfinished queues in order
pop(), and accumulates the length. - Once a queue becomes empty, record its length as the candidate minimum and stop subsequent operations on that queue.
- When all queues are complete, the minimum length is the answer.
Sample Code (Java)
public static int findShortestLength(Queue<Integer>[] queues) {
int n = queues.length;
int[] lengths = new int[n];
boolean[] done = new boolean[n];
int minLen = Integer.MAX_VALUE;
while (true) {
boolean allDone = true;
for (int i = 0; i < n; i++) {
if (!done[i]) {
allDone = false;
queues[i].pop();
lengths[i]++;
if (queues[i].empty()) {
done[i] = true;
minLen = Math.min(minLen, lengths[i]);
}
}
}
if (allDone) break;
}
return minLen;
}
Q2: Find the queue with the smallest sum of elements
Problem description
The same applies to a number of organizations that can only pop()/empty() of the queue, find the queue with the smallest sum of elements, and return that smallest sum.
Clarify
- Maintains the cumulative sum of each queue popup element.
- Once a queue becomes empty, compare and update the global minimum sum.
Ideas
- For all outstanding queues in order
pop()and accumulates its sum. - If a queue is empty, record its sum and update the global minimum.
- In order to terminate early, it can be detected in the loop: if the current cumulative sum of all unfinished queues is ≥ the known minimum sum, it can be skipped.
Sample Code (Java)
public static int findSmallestSum(Queue<Integer>[] queues) {
int n = queues.length;
int[] sums = new int[n];
boolean[] done = new boolean[n];
int minSum = Integer.MAX_VALUE;
while (true) {
boolean allDone = true;
boolean possibleSmaller = false;
for (int i = 0; i < n; i++) {
if (!done[i]) {
allDone = false;
int v = queues[i].pop();
sums[i] += v;
if (queues[i].empty()) {
done[i] = true;
minSum = Math.min(minSum, sums[i]);
} else if (sums[i] < minSum) {
possibleSmaller = true;
}
}
}
if (allDone || !possibleSmaller) break;
}
return minSum;
}
Contact us
如果准备过程中遇到卡壳、没思路、时间不够用,ProgramHelp 提供 OA 代做、代码辅导、面试模拟、代面试等全流程服务, 陪你从投递到上岸,全程保驾护航! View Services and Prices →