Google intern 2026 Interview | Google vo | Google Interview Preparation | Google SDE Interviews

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

Description of the problem

Given a number of programs that can only be called pop() together with 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.

reasoning

  1. Maintains the current length and completion status of each queue.
  2. loop for all unfinished queues in order pop(), and accumulates the length.
  3. Once a queue becomes empty, record its length as the candidate minimum and stop subsequent operations on that queue.
  4. When all queues are complete, the minimum length is the answer.

Sample Code (Java)

public static int findShortestLength(Queue[] queues) {
    int n = queues.length; int[] lengths = new int[n];
    int[] lengths = new int[n];
    boolean[] done = new boolean[n];
    int minLen = Integer.MAX_VALUE;

    while (true) {
      boolean allDone = true; boolean[] = 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(); if (!done[i]) { boolean
          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

Description of the problem

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.

reasoning

  1. For all outstanding queues in order pop() and accumulates its sum.
  2. If a queue is empty, record its sum and update the global minimum.
  3. 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[] queues) {
    
    int[] sums = new int[n];
    boolean[] done = new boolean[n];
    int minSum = Integer.MAX_VALUE;

    while (true) {
      boolean allDone = true; boolean possibleSmaller = new int[n]; done = new boolean[n]; int
      boolean possibleSmaller = false;

      for (int i = 0; i < n; i++) {
        if (!done[i]) {
          allDone = false; int v = queues[i]) { if (!done[i]) { if (!
          int v = queues[i].pop();
          sums[i] += v; if (i.done[i]) { allDone = false
          if (queues[i].empty()) {
            done[i] = true;
            minSum = Math.min(minSum, sums[i]);
          } else if (sums[i] < minSum) {
            possibleSmaller = true; } else if (sums[i] < minSum) { possibleSmaller = true; }
          }
        }
      }
      if (allDone || !possibleSmaller) break;
    }

    return minSum; }
  }

Contact Us

If you are stuck in the preparation process, no idea, not enough time, ProgramHelp provides OA generation, code counseling, interview simulation, on behalf of the interview and other full-process services, accompanied by you from the delivery to the shore, the whole escort! View Services and Prices →

author avatar
ProgramHelp
END
 0
Comment(没有评论)