← Back to blog Google NG Online Assessment Debrief: Two Prefix/Suffix Problems + a Pattern-Finding Mindset
Google

Google NG Online Assessment Debrief: Two Prefix/Suffix Problems + a Pattern-Finding Mindset

2026-06-04

Google's New Grad OA opened at the end of August, quite a bit later than other big firms. The question types continue the previous style—clear, logical algorithm problems—with the core being "find the pattern → transform the problem." Here are two real problems I have done, with representative approaches.

1. Google NG OA Overview

Dimension Details
Platform Some batches on Codility, some on HackerRank
Duration ~75 minutes
Count 2 algorithm problems (array / prefix-suffix / math thinking)
Difficulty Overall moderate, short statements, but grasp the core idea
Focus Array + math derivation, prefix-max / suffix-min patterns

Key reminder: the problems look simple, but the key is quickly spotting a math pattern or a prefix/suffix relationship—O(n) or O(n log n) is needed; brute force will TLE.

2. Problem 1: Minimize Absolute Sum After One Flip

Given an integer array, you may flip at most one element (multiply by -1). Find the minimum possible absolute value of the array sum after the change.

Example: [2, -3, 5] → output 0. Original sum = 4. Flip 5 → sum = -1, abs = 1; flip 2 → sum = 0. Best is 0.

def minAbsSum(arr):
    s = sum(arr)
    best = abs(s)                       # baseline with no flip
    for x in arr:
        # flipping x is equivalent to changing the sum by -2*x
        best = min(best, abs(s - 2 * x))
    return best

Transformation: turn "multiply by -1" into "sum changes by -2*x." Iterate each element taking min(abs(s - 2*x)), then compare with abs(s). Complexity: time O(n), space O(1).

3. Problem 2: Count Sorted-Concatenation Splits

Given an array, split it into two non-empty parts left and right, sort each, and concatenate. Count how many split ways make the final concatenated array sorted.

Example: [2, 1, 3, 5] → output 2. Split at index 2 ([2,1]|[3,5]) → [1,2,3,5] sorted; split at index 3 ([2,1,3]|[5]) → [1,2,3,5] sorted.

def countSortedSplits(arr):
    n = len(arr)
    # prefix_max[i]: max of the first i+1 elements
    prefix_max = [0] * n
    prefix_max[0] = arr[0]
    for i in range(1, n):
        prefix_max[i] = max(prefix_max[i - 1], arr[i])
    # suffix_min[i]: min from i to the end
    suffix_min = [0] * n
    suffix_min[n - 1] = arr[n - 1]
    for i in range(n - 2, -1, -1):
        suffix_min[i] = min(suffix_min[i + 1], arr[i])
    # split between i and i+1: valid iff left max <= right min
    count = 0
    for i in range(n - 1):
        if prefix_max[i] <= suffix_min[i + 1]:
            count += 1
    return count

Transformation: whether the sorted concatenation is ordered is equivalent to left-segment max <= right-segment min. Precompute prefix_max and suffix_min, then check each split point. Complexity: time O(n), space O(n).

This problem looks like a "mock sort" but is really the classic prefix/suffix information pattern.

4. Pattern-Finding Mindset

Step Action
1. Don't rush to code First ask "what math property is this testing"
2. Transform the operation e.g. "multiply by -1" → "sum changes by -2x"—turn the operation into a computable quantity
3. Look for prefix/suffix "left and right segments" / "split points" usually means prefix/suffix
4. Verify complexity Two problems in 75 minutes, brute O(n^2) likely TLEs, target O(n)

FAQ

Q1: Which platform is the Google NG OA on?

Some batches use Codility, some HackerRank—go by the invite email. The environments differ slightly; familiarizing yourself with the editor and submission flow in advance saves time.

Q2: The problems look simple—why do people still fail?

Because brute force TLEs. The Google NG OA looks simple but requires O(n) / O(n log n). Most who fail did not find the math pattern or prefix/suffix transformation and wrote a double loop that timed out.

Q3: Are prefix-max / suffix-min patterns common?

Very. Any problem involving "splitting an array" or "comparing left and right segments" can usually be solved in O(n) with prefix_max / suffix_min precomputation. This is a frequent Google NG OA pattern—practice it well.

Q4: What if I can't find the approach in 75 minutes?

The most time-consuming part is getting stuck on "finding the pattern." We offer OA assistance: question-type prediction + timed practice + real-time hints on the transformation when you stall, so you do not burn all your time on one problem.


Preparing for the Google NG OA?

The Google NG OA tests pattern-finding and problem transformation, not rote grinding. If you want timed practice on these two problems, focused work on prefix/suffix patterns, 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 NG OA questions and practice.

Contact