Google Online Assessment | Google 2026 Intern OA 面经分享

1,342閱讀
沒有評論

Google 2026 Intern 的 OA 终于在 8 月底开了,相比其他大厂算是比较晚的。今年题型延续了以往风格,依旧是逻辑清晰、考察思维的算法题。我这边整理两道以前做过的 OA 题,题意和思路都挺有代表性,给大家一个参考。

Google Online Assessment

Google Online Assessment 面试概览

  • 平台:部分批次在 Codility,部分批次在 HackerRank
  • 时长:75 分钟左右
  • 题量:2 道算法题(数组/前缀后缀/数学思维)
  • 难度感受:整体中等,题面不长,但需要抓住核心思路才容易做对
  • 考察点
    • 数组与数学推导结合
    • 前缀最大 / 后缀最小的处理思路
    • 时间复杂度要求 O(n) 或 O(n log n),暴力会超时
  • 建议:一定要提前熟悉 Google OA 的套路题,重在「发现规律 → 转换问题」

真题回顾

Question 1: Minimize Absolute Sum After One Change

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

Example
Input: [2, -3, 5]
Output: 0
Explanation: Original sum = 4. Flipping 5 → sum = -1, abs = 1. Flipping 2 → sum = 0. So the best result is 0.

思路解析

  • 先算出原数组总和 s
  • 如果翻转一个元素 a[i],总和变为 s - 2*a[i]
  • 遍历每个元素,取 min(abs(s - 2*a[i]))
  • 最后和 abs(s) 比较,答案就是二者的最小值。

这里的关键就是把「乘 -1」转化为「总和变化 -2*a[i]」。实现上只要一次遍历即可,复杂度 O(n)。

Question 2: Count Sorted Split Ways

You are given an array. You want to split it into two non-empty parts: left and right.
Then sort each part in non-decreasing order, and concatenate them.
Return the number of ways to split the array so that the final concatenated array is sorted.

Example
Input: [2, 1, 3, 5]
Output: 2
Explanation:

  • Split at index 1 → left [2], right [1,3,5][2,1,3,5] not sorted.
  • 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 ✅.

思路解析

  • 排序后,左段的最大值是 max(left),右段的最小值是 min(right)
  • 拼接后是否有序,只要满足 max(left) <= min(right) 即可。
  • 因此遍历每个切分点,判断条件成立与否。
  • 实现上可以先预处理:
    • prefix_max[i] 表示前 i 个元素的最大值
    • suffix_min[i] 表示从 i 到末尾的最小值
  • 最后统计满足 prefix_max[i] <= suffix_min[i+1] 的分割点数量即可,复杂度 O(n)。

这道题表面上是「模拟排序」,其实是「前缀/后缀信息」的经典套路。

Google Online Assessment 小结

这两道 OA 题风格很典型:题面看似简单,核心在于能不能快速发现数学规律或前后缀关系。第一题是「数值翻转的等价转化」,第二题是「数组拼接的最大最小边界条件」。只要思路清晰,代码实现并不难。

Offer之路不在孤单

很多同学做 Google OA 时,都会遇到「思路卡住 → 时间被拖走」的情况。Programhelp 提供 无痕联机助攻:

  • 实时语音提醒,帮你卡点转思路,不会陷在 brute force 里出不来;
  • 远程联机辅助,保证代码实现高效无误;
  • 提前演练 Google 高频 OA 题库,模拟实战环境。

别再一个人死撑,有 Programhelp 在,OA 也能轻松拿下 ✅。

author avatar
jor jor
正文完
 0
评论(沒有評論)