FastPrepLatest Arrival Time for a Shuttle
Problems/Latest Arrival Time for a Shuttle

Latest Arrival Time for a Shuttle

Google logoGoogle● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report does not give exact tie rules or input limits. Our version is about 95% the same as the reported question.

You are given integer shuttle departure times shuttles, integer arrival times passengers for the other passengers, and the capacity of every shuttle.

A passenger may board a shuttle when the passenger arrives no later than that shuttle departs. Process the other passengers from earliest arrival to latest arrival. Each passenger boards the earliest shuttle that still has an available seat.

Choose an integer arrival time for yourself. Your arrival time must be different from every value in passengers. Return the latest arrival time that still lets you board some shuttle.

The input arrays may be unsorted. If the final shuttle has an empty seat after the other passengers board, its departure time is the latest initial candidate. If it is full, the latest initial candidate is one unit before the last passenger who boarded it. In either case, move the candidate earlier while another passenger already uses that time.

Function

latestShuttleArrival(shuttles: int[], passengers: int[], capacity: int) → int

Examples

Example 1

shuttles = [10,20]passengers = [2,17,18,19]capacity = 2return = 16

The shuttle at 20 fills with passengers arriving at 17 and 18. You must arrive before 18, and 17 is already occupied, so the latest available time is 16.

Example 2

shuttles = [20,30]passengers = [19,20,21,29]capacity = 2return = 28

The shuttle at 30 boards the passengers at 21 and 29. It is full, so you must arrive before 29; 28 is unused.

Example 3

shuttles = [10]passengers = [2,3]capacity = 3return = 10

One seat remains on the shuttle, and no passenger arrives at its departure time, so you may arrive at 10.

Constraints

  • 1 <= shuttles.length, passengers.length <= 10^5.
  • 1 <= capacity <= 10^5.
  • 1 <= shuttles[i], passengers[i] <= 10^9.
  • Departure times are unique within shuttles, and arrival times are unique within passengers.
  • At least one valid arrival time exists.

More Google Onsite Interview questions

  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Experiment Bucket Allocation and RebalancingPinterest · PHONE SCREENPinterest interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Minimum Station Tracks for a Train ScheduleBNSF Railway · ONSITE INTERVIEWBNSF Railway interview questions
  • Reduce Array Size to At Most HalfMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Merge Sort Report with a Noisy ComparatorMercor · ONSITE INTERVIEWMercor interview questions
  • Maximize Monsters DefeatedSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Select K Paired Indices for Maximum ScoreAmazon · ONSITE INTERVIEW
  • Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Minimum Removals for Non-Overlapping IntervalsByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int latestShuttleArrival(int[] shuttles, int[] passengers, int capacity) {
      // Write your code here.
    }
}
Checking account…