← Back to blog Google SWE Intern OA Debrief: High Score on 2 Problems in 30 Minutes + Four Frequent Problems Solved
Google

Google SWE Intern OA Debrief: High Score on 2 Problems in 30 Minutes + Four Frequent Problems Solved

2026-06-04

Just helped a student finish a Google SWE Intern OA. The format is still two coding problems, 30 minutes. Difficulty is slightly higher than TikTok—both problems were medium-leaning-up. Where it used to favor conventional data structures, this year it emphasizes graph algorithms and variants more. Here are the frequent question types for those aiming at Google.

1. Google SWE Intern OA Overview

Dimension Details
Count 2 coding problems
Duration ~30 minutes
Difficulty Medium-leaning-up, no extreme hards
Trend Rising share of graph algorithms + variants
Focus Ability to decompose + handle variants

Core trait: Google does not chase hard problems but likes to put variants on classics—knowing the original is not enough; you must handle changed conditions.

2. Problem 1: Count Palindromic Substrings (DP / Expand Around Center)

Given a string s, return the number of palindromic substrings in it.

def countSubstrings(s):
    n, count = len(s), 0
    def expand(l, r):
        cnt = 0
        while l >= 0 and r < n and s[l] == s[r]:
            cnt += 1
            l -= 1
            r += 1
        return cnt
    for i in range(n):
        count += expand(i, i)      # odd center
        count += expand(i, i + 1)  # even center
    return count

Approach: expand around center, with each char (or between two chars) as the center. Complexity: time O(n^2), space O(1)—better than the O(n^2) space of a DP table.

3. Problem 2: Climbing Stairs (Classic DP, Mind the Variants)

n stairs, climb 1 or 2 at a time—how many ways to reach the top?

def climbStairs(n):
    a, b = 1, 1  # dp[0]=1, dp[1]=1
    for _ in range(2, n + 1):
        a, b = b, a + b
    return b

Approach: dp[i] = dp[i-1] + dp[i-2], rolling variables to O(1) space. Google variant reminder: often changed to "climb 1/2/3 steps" (three-term recurrence) or "some steps cannot be stepped on" (set dp[i]=0 for those i). Always practice variants.

4. Problem 3: Binary Tree Maximum Path Sum (Recursion)

Given a binary tree root, return the maximum sum of any non-empty path.

def maxPathSum(root):
    best = float('-inf')
    def gain(node):
        nonlocal best
        if not node:
            return 0
        # cut off negative contributions (take 0)
        left = max(gain(node.left), 0)
        right = max(gain(node.right), 0)
        # path sum passing through the current node (may include both sides)
        best = max(best, node.val + left + right)
        # return to parent: can only pick one edge
        return node.val + max(left, right)
    gain(root)
    return best

Key: distinguish two concepts—the "max path sum going down to the current node" (returnable to parent, only one edge) and the "max path sum passing through the current node" (may include both sides, used to update the answer). Complexity: time O(n), space O(h).

5. Problem 4: Course Schedule (Topological Sort, Cycle Detection)

numCourses courses, prerequisites[i] = [a, b] means you must take b before a. Can you finish all courses?

from collections import deque, defaultdict

def canFinish(numCourses, prerequisites):
    indeg = [0] * numCourses
    graph = defaultdict(list)
    for a, b in prerequisites:
        graph[b].append(a)
        indeg[a] += 1
    # enqueue nodes with in-degree 0 first
    q = deque([i for i in range(numCourses) if indeg[i] == 0])
    done = 0
    while q:
        node = q.popleft()
        done += 1
        for nxt in graph[node]:
            indeg[nxt] -= 1
            if indeg[nxt] == 0:
                q.append(nxt)
    return done == numCourses  # all dequeued = no cycle

Approach: essentially cycle detection in a directed graph. Topological sort maintains in-degrees, removing in-degree-0 nodes each time; if all are removed there is no cycle. Complexity: time O(V + E), space O(V + E).

6. Prep Cadence

Question type Focus
DP Climbing stairs/palindromes, practice variants (multi-step, forbidden steps)
Tree The two-concept distinction in max path sum is a frequent point
Graph Topological sort / DFS cycle detection are must-practice
General Google loves variants—master originals, then practice changed conditions

FAQ

Q1: How hard is the Google Intern OA?

Two medium-leaning-up problems, 30 minutes. No extreme hards, but graph algorithms and variants take a bigger share this year. The focus is decomposition ability, not memorizing originals.

Q2: Are simple problems like climbing stairs really asked?

Yes, but usually with a variant—climb 1/2/3 steps, or some steps forbidden. Memorizing the original gets stuck on changed conditions; always practice the variant recurrences.

Q3: Where is max path sum most easily wrong?

Confusing the "path returned to parent" (one edge only) with the "path passing through the current node" (may include both sides). The former is for the recursive return, the latter updates the global answer—swap them and it is wrong.

Q4: Is 30 minutes enough for two problems?

Yes, provided you have practiced the frequent types and can spot patterns fast. Getting stuck on the approach burns the most time. We offer OA assistance: question-type prediction + timed practice + real-time direction to lock in what you know.


Preparing for the Google SWE Intern OA?

The Google OA tests decomposition and variant-handling, not exotic puzzles. If you want timed practice on the four frequent problems, focused work on graph/DP variants, or real-time OA assistance, reach out—send the role's JD and we will predict the question types first, then plan a practice schedule.

Add WeChat Coding0201 now to get Google OA questions and practice.

Contact