FastPrepReach a Destination Through Scheduled Flights

Reach a Destination Through Scheduled Flights

Google logoGoogle● MediumNEW GRADPHONE SCREENONSITE INTERVIEW

Problem statement

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

You begin at startAirport at time 0. You may take a flight from your current airport when its departure time is at least your current arrival time. After taking it, your current time becomes its arrival time.

The problem statement continues
Pro

Examples

Example 1

airportCount = 3flights = [[0,1,2,5],[1,2,5,8]]startAirport = 0targetAirport = 2return = true

Take the first flight and arrive at airport 1 at time 5. The second flight departs exactly at time 5, so the connection is valid.

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
See Google hiring insights
CodePython 3
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