FastPrepMinimum Total Layover Wait
Problems/Minimum Total Layover Wait

Minimum Total Layover Wait

Google logoGoogle● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionExamples

Problem statement

Source note: In a Google technical phone screen for a 2027 summer internship, the candidate got flights with origin, destination, departure and arrival times, plus a start and a destination. First they had to decide whether the destination can be reached when every flight must be boarded at an airport you have already reached in time. That base question is the separate problem Reach a Destination Through Scheduled Flights. The follow-up, which is the task here, asks for the smallest total waiting time over all workable routes. Each connection's wait is the next departure minus the previous landing.

The report gives no examples, limits, or boundary rules. We chose these: you start at time 0, boarding is allowed when the departure is at or after your arrival, time at the start before the first flight is not counted, a start equal to the destination needs no flights and waits 0, and an unreachable destination returns -1. The limits and examples are ours.

Our version is about 85% the same as the reported follow-up.

There are airportCount airports numbered 0 through airportCount - 1. Each flight is [origin, destination, departureTime, arrivalTime].

You start at startAirport at time 0. You may board a flight at your current airport when its departure time is at least the time you got there; after the flight you are at its destination at its arrival time.

A connection is a change from one flight to the next. Its waiting time is the next flight's departure time minus the previous flight's arrival time. Time spent at startAirport before your first flight does not count. The total waiting time of a route is the sum over all of its connections, so a route with a single flight waits 0.

The problem statement continues
Pro

Examples

Example 1

airportCount = 3flights = [[0,1,1,3],[0,1,5,6],[1,2,7,9]]startAirport = 0targetAirport = 2return = 1
  • Taking flight [0, 1, 1, 3] reaches airport 1 at time 3; the flight to airport 2 leaves at 7, so the wait is 7 - 3 = 4.
  • Taking the later flight [0, 1, 5, 6] reaches airport 1 at time 6, and the wait is only 7 - 6 = 1. Waiting at the start airport before the first flight does not count.
  • The smallest total wait is 1.
02 · Example 2
FastPrep Pro
Reported in 1 Google interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week

More Google Phone Screen questions

  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Logger Rate Limiter with Every-Arrival HistoryPHONE SCREEN · Seen Nov 2026
  • Reach a Destination Through Scheduled FlightsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Boards to Cover Roof HolesPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Platform Referral RewardsScale AI · OAScale AI interview questions
  • Shipping Starts and Terminal DestinationsIntuit · OAIntuit interview questions
  • All Halfway Courses Across Course TracksCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Shortest Paths in a Nonnegative Directed GraphNation with NaMo · PHONE SCREEN
  • Deterministic Secret Santa AssignmentShopify · PHONE SCREENShopify interview questions
  • Minimum Traveling Salesperson TourGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
  • Minimum Completion Time for DAG DependenciesAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Work Order Critical PathHadrian · PHONE SCREENHadrian interview questions
  • Longest Name Chain in a Directed Acyclic GraphOscar Health · PHONE SCREEN
  • Service Dependency Load FactorsRobinhood · PHONE SCREENRobinhood interview questions

Google interview experiences

  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
  • Google AI Coding Interview and AI OA: 2 Experiences
  • Google SWE Intern Interview Results Timeline: 13 Experiences
  • Google L4 SWE Phone Screen and Kirkland Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
CodePython 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import heapq
from collections import defaultdict
 
class Solution:
def solve(self, values, queries):
# Build the adjacency structure
n = len(values)
graph = defaultdict(list)
for u, v in queries:
graph[u].append(v)
 
best = [float("inf")] * n
heap = [(0, 0)]
while heap:
cost, node = heapq.heappop(heap)
if cost > best[node]:
continue
Run and Submit unlock with Pro
FastPrep Pro
Reported in 1 Google interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week