Amazon 四轮 VO 面试经验分享:有序数组平方+腐烂橘子BFS+电梯OOD+字符串压缩 - Oavoservice

Amazon 四轮 VO 面经 2025-09-11
最近辅助的一场亚麻VO四轮,顺利结束了,提前mock过的,配合很是默契,四轮时间不是一连续的了,分两天或者三天进行,最近接的几场都是安排在了两天时间线,简单说一下这场
Round 1: 技术面 + Coding
国人小哥,自我介绍之后简历被挖掘了几个技术问题,就是一些项目上的技术问题,又问了几个两个LP:
- Take the initiative to assume responsibility
- Simplify complex problems
两个问题比较简单,并未过于为难,接下来是两道coding:
题目1:有序数组的平方
双指针和暴力都行,我给的代码用的是双指针
def sortedSquares(nums):
n = len(nums)
result = [0] * n
left, right = 0, n - 1
index = n - 1
while left <= right:
if abs(nums[left]) > abs(nums[right]):
result[index] = nums[left] * nums[left]
left += 1
else:
result[index] = nums[right] * nums[right]
right -= 1
index -= 1
return result
题目2:腐烂的橘子
使用BFS就好
def orangesRotting(grid):
from collections import deque
m, n = len(grid), len(grid[0])
queue = deque()
fresh = 0
# 找到所有腐烂的橘子和新鲜橘子的数量
for i in range(m):
for j in range(n):
if grid[i][j] == 2:
queue.append((i, j))
elif grid[i][j] == 1:
fresh += 1
if fresh == 0:
return 0
directions = [(0, 1), (0, -1), (1, 0), (-1, 0)]
minutes = 0
while queue:
size = len(queue)
for _ in range(size):
x, y = queue.popleft()
for dx, dy in directions:
nx, ny = x + dx, y + dy
if 0 <= nx < m and 0 <= ny < n and grid[nx][ny] == 1:
grid[nx][ny] = 2
fresh -= 1
queue.append((nx, ny))
if queue:
minutes += 1
return minutes if fresh == 0 else -1
Round 2: BQ + OOD
美国老哥,英语很地道,这轮是BQ+OOD
BQ问题:
- I have taken on tasks beyond one's duties, What happened in the end? Did it succeed?
- Dive Deep: Delve into the details to identify key issues
OOD: 电梯系统设计
设计一个电梯系统,需要考虑:
- 电梯的基本功能(上下移动、开关门)
- 楼层请求处理
- 电梯调度算法
- 状态管理
class Elevator:
def __init__(self, id, current_floor=1):
self.id = id
self.current_floor = current_floor
self.direction = 0 # 0: idle, 1: up, -1: down
self.requests = set()
self.door_open = False
def request_floor(self, floor):
self.requests.add(floor)
def move(self):
if not self.requests:
self.direction = 0
return
if self.direction == 1: # 向上
next_floor = min([f for f in self.requests if f > self.current_floor], default=None)
if next_floor:
self.current_floor = next_floor
self.requests.remove(next_floor)
else:
self.direction = -1
elif self.direction == -1: # 向下
next_floor = max([f for f in self.requests if f < self.current_floor], default=None)
if next_floor:
self.current_floor = next_floor
self.requests.remove(next_floor)
else:
self.direction = 1
else: # idle
if self.requests:
target = min(self.requests)
self.direction = 1 if target > self.current_floor else -1
class ElevatorSystem:
def __init__(self, num_elevators, num_floors):
self.elevators = [Elevator(i) for i in range(num_elevators)]
self.num_floors = num_floors
def call_elevator(self, floor, direction):
# 选择最近的电梯
best_elevator = min(self.elevators,
key=lambda e: abs(e.current_floor - floor))
best_elevator.request_floor(floor)
return best_elevator.id
def step(self):
for elevator in self.elevators:
elevator.move()
Round 3: 纯BQ
Bar raiser,问了一大堆follow up:
- The most complex project, follow up: trade-offs
- The most failed project, what have you learned from it
- What would you do if you found out that yours is not the best way
很多细节不太记得了,烙印频频打断,说了好多,还好准备的够充分,回答的还算满意
Round 4: BQ + Coding
常规的BQ 20分钟,白男,接着给定一个字符串和一个前缀长度prefix_len,压缩字符串:保留前prefix_len个字符和最后一个字符,中间部分用数字表示省略的字符个数。
字符串压缩题目
给定一个字符串和一个前缀长度prefix_len,压缩字符串:保留前prefix_len个字符和最后一个字符,中间部分用数字表示省略的字符个数。
def compress_string(s, prefix_len):
if len(s) <= prefix_len + 1:
return s
prefix = s[:prefix_len]
suffix = s[-1]
middle_count = len(s) - prefix_len - 1
return f"{prefix}{middle_count}{suffix}"
# 示例
# compress_string("hello", 2) -> "he3o"
# compress_string("world", 1) -> "w3d"
Follow-up: 唯一性压缩
给定一组字符串,对每个字符串进行压缩,但要求所有压缩结果必须唯一
def compress_strings_unique(strings, prefix_len):
compressed = {}
result = {}
for s in strings:
compressed_str = compress_string(s, prefix_len)
if compressed_str in compressed:
# 如果压缩结果重复,需要调整
original = compressed[compressed_str]
# 可以增加前缀长度或者添加后缀来区分
new_compressed = f"{s[:prefix_len+1]}{len(s)-prefix_len-2}{s[-1]}"
result[s] = new_compressed
compressed[new_compressed] = s
else:
result[s] = compressed_str
compressed[compressed_str] = s
return result
算法详解
这次Amazon四轮VO涵盖了多个经典算法和设计模式,让我们深入分析一下:
1. 有序数组的平方 - 双指针技巧
核心思想:由于数组已经有序,最大的平方值要么在最左边(负数),要么在最右边(正数)。使用双指针从两端向中间遍历。
2. 腐烂的橘子 - BFS层序遍历
核心思想:模拟腐烂过程,每一轮BFS代表一分钟,统计需要多少轮才能让所有橘子腐烂。
3. 电梯系统 - OOD设计模式
核心思想:状态机设计,电梯有idle、up、down三种状态,根据请求队列决定下一步行动。
4. 字符串压缩 - 字符串处理
核心思想:保留前缀和后缀,中间用数字表示省略的字符数量,处理唯一性时需要额外的去重逻辑。
面试技巧分享
在Amazon的四轮VO面试中,每轮都有不同的侧重点:
1. 技术轮 - 算法实现
重点展示代码质量和算法思维,能够快速写出bug-free的代码。
2. 设计轮 - 系统设计
重点展示面向对象设计能力,能够设计出可扩展的系统架构。
3. BQ轮 - 行为问题
重点展示领导力原则,能够用STAR方法讲述具体案例。
4. 综合轮 - 综合能力
重点展示综合能力,能够处理复杂的问题和follow-up。
Oavoservice 实时辅助服务
在这次Amazon四轮VO面试中,我们的实时辅助系统发挥了关键作用:
- 提前Mock:帮助候选人熟悉面试流程和题型
- 实时提示:在关键时刻提供思路和代码优化建议
- BQ准备:提前准备领导力原则的具体案例
- 心理支持:帮助候选人在多轮面试中保持稳定状态
结语
Amazon的四轮VO面试是对候选人综合能力的全面考察,从算法实现到系统设计,从行为问题到领导力原则,每一轮都有其独特的价值。在Oavoservice的实时辅助下,候选人能够充分发挥自己的技术实力和沟通能力。
如果你也在准备Amazon或其他大厂的多轮VO面试,欢迎联系Coding0201 Oavoservice。我们提供专业的面试辅导和实时辅助服务。
Oavoservice - 让每一次面试都成为成功的机会!