返回博客列表
软件开发 SDE
Uber SWE New Grad面试题和答案
New Grad Interview Questions & Answers
2025-02-15
20分钟阅读
Interview Expert
Uber SWE New Grad面试题和答案:Coding & System Design 实战
[!NOTE] 马上毕业季了,Uber 的 SWE New Grad 面试以 "Practical" 著称。他们不喜欢考偏门的 DP,更喜欢考 HashMap 和 Tree 的实际应用。
1. OA (Online Assessment) - The Filter
一般是 70 分钟,2-4 道题。题库比较固定。
经典题型
- Subarray Sum Equals K: 使用
HashMap存 prefix sum,做到 O(N)。- Why? 这是典型的 Data Aggregation 场景。
- Two Sum / 3Sum: 重点是能否处理 Duplicates。
- Merge K Sorted Lists: Min-Heap 是标准解法。
- Optimization: 如果内存不够怎么办?(Merge 2 at a time, Divide & Conquer)。
2. Coding Round: Not just "AC" (Accepted)
Uber 的面试官非常看重 Code Quality 和 Scalability。不要只追求跑通 Test Case。
Deep Dive: Code Snippet Analysis
Scenario: "Design a Ride Fare Estimator." 面试官可能会给你一段 "Working but Bad" 的代码,让你优化。
Bad Code:
def get_fare(miles, minutes):
base = 2.0
if miles > 10:
base += 1.0
return base + miles * 1.5 + minutes * 0.5
Critique (你要指出的点):
- Hardcoded Constants:
2.0,1.5是 Magic Numbers。应该提取为 Config。 - Scalability: 如果以后要根据 City, Time of Day 加价怎么办?
- Refactored Design (Strategy Pattern):
class FareStrategy: def calculate(self, trip_data): pass class SurgeStrategy(FareStrategy): ...
Insight: 这种 Refactoring 能力比单纯默写 Dijkstra 算法更能打动 Uber 面试官。
3. System Design (Lightweight)
对于 New Grad,System Design 不会太深,但你要懂 Marketplace Dynamics (Two-sided market)。
- Driver vs Rider Matching:
- Geo-hashing: 怎么快速找到附近的司机?(Geohash / Google S2).
- Concurrency: 两个 Rider 同时叫同一辆车怎么办?(Database Locking / Redis Atomic Operations).
4. Behavioral (BQ)
Uber 非常看重 "Go Get It" 的精神。
- Question: "Tell me about a time you optimized a slow process."
- Answer Key: 重点描述你如何发现瓶颈 (Profiling),采取行动 (Caching/Parallelism),最后量化结果 (Latency reduced by 300ms)。
总结
Uber 的面试很有挑战性,但只要你准备充分 (HashMap 熟练度 + Code Quality + Marketplace Sense),拿下 Offer 并不难。
#Uber #面试经验 #SoftwareEngineer #NewGrad #求职 #北美求职 #SystemDesign #Refactoring
sdeInterviewQuestionsGuide2025
