Google SDE VO Round 1: Minimum Cars for Rental Records + Assignment (Sort + Min-Heap)
Google SDE VO round one recap: after a quick project chat, a car rental scheduling problem — given unsorted pickup/return records, return the minimum number of cars and which car serves each record, using sorting and a greedy min-heap.
Overview
The interviewer was cheerful and smiled throughout — easy to talk to and not the type to give you a hard time.
After a self-introduction she asked briefly about a project. I think it was just a formality: no follow-ups, and the questions were very general.
Coding: car rental scheduling
Problem
You're given last year's rental records, each with a pickup_time, a return_time and a record ID, roughly like this:
(id=101, pickup=3, return=5)
Find the minimum number of cars needed to serve every rental, and return an assignment (which car serves each record).
Two key clarifications
- Edge case: if A's return time equals B's pickup time, can they share a car? — Yes.
- Is the input sorted? The optimal solution differs depending on whether it's sorted by pickup. — It's not sorted.
Approach: sort + greedy min-heap
- Sort by pickup time.
- The min-heap stores each car's available time (its return time) and car ID.
- For each request: if its pickup time is at or after the top car's return time, reuse that car; otherwise add a new car to the heap.
- A map records the assignment for each record.
import heapq
def assign_rentals(rentals):
"""rentals: [(id, pickup, return)]; returns (min number of cars, {rental id: car id})"""
heap, assignment, cars = [], {}, 0 # heap: (available time, car id)
for rid, pickup, ret in sorted(rentals, key=lambda r: (r[1], r[2])):
if heap and heap[0][0] <= pickup: # reusable if returned at or before pickup
_, car = heapq.heappop(heap)
else:
car, cars = cars, cars + 1
assignment[rid] = car
heapq.heappush(heap, (ret, car))
return cars, assignment
Time O(n log n), space O(n).
For a similar problem, see Google SDE VO 8/5: car rental interval scheduling, which uses a sweep line plus an idle-car pool.
Found this helpful? Let's talk.
Happy to swap interview notes, do mock interviews, or share referral info.

Scan to add me on WeChat
More Google notes
View all ›- Google 2027 SWE Intern VO, Fresh Recap: HashMap + Sliding Window and Graph BFSGoogle · 2026-10-04›
- Google Summer Intern | SDE Summer Internship | Real Google Interview QuestionsGoogle · 2026-10-04›
- Google 2027 SDE Intern (Passed): Undirected Unweighted Graph — Fewest Edges for Alice and Bob to Reach the DestinationGoogle · 2026-10-02›
- Google SDE 2027 Intern: Subarray Sum Modulo Equals k + Three Follow-upsGoogle · 2026-10-02›