FastPrepRestaurant Waitlist with Exact-Size Tables
Problems/Restaurant Waitlist with Exact-Size Tables

Restaurant Waitlist with Exact-Size Tables

Google logoGoogle● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: One report describes join, leave, and serving only a party whose size exactly equals the table, with edge cases for duplicate joins and leaves. Another report confirms that exact size versus at-most size is a policy the interviewer can pick. This exercise covers the exact-size version. Our version is about 91% the same as the reported question.

Process operations against an initially empty restaurant waitlist.

  • JOIN id size appends a party unless that ID is already waiting.
  • LEAVE id removes that party when present and otherwise does nothing.
  • SERVE tableSize removes and returns the earliest waiting party whose size is exactly tableSize, or NONE if no exact-size party waits.

An ID may join again after leaving or being served. Only SERVE operations produce output.

Function

processExactWaitlist(operations: String[][]) → String[]

Examples

Example 1

operations = [["JOIN","A","4"],["JOIN","B","2"],["JOIN","C","4"],["SERVE","4"],["SERVE","4"]]return = ["A","C"]

Exact-size parties are served in their join order.

Example 2

operations = [["JOIN","A","3"],["JOIN","A","3"],["LEAVE","A"],["LEAVE","A"],["SERVE","3"],["JOIN","A","3"],["SERVE","3"]]return = ["NONE","A"]

Duplicate operations are idempotent, and A may rejoin after leaving.

Example 3

operations = []return = []

No operations produce no service results.

Constraints

  • 0 <= operations.length <= 200000.
  • Party IDs contain 1 through 20 letters or digits.
  • Party and table sizes are integers in [1,100000].
  • Operation rows have the exact arity shown above.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 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
  • 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

  • Metric Counter with a Fake ClockSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Per-Client Sliding-Window Rate LimiterNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions
  • Article Vote TrackerRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Durable Work Queue OperationsOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Matching Engine with Order CancellationIMC Trading · ONSITE INTERVIEWIMC Trading interview questions
  • Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
  • Per-Client Sliding-Window Rate LimiterGeneral Motors · OA
  • Recent Event Stream QueriesSnowflake · PHONE SCREENSnowflake interview questions
  • Completions API Rate LimiterCursor · PHONE SCREENCursor interview questions
  • Truck Position SubscriberOptiver · OAOptiver 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 String[] processExactWaitlist(String[][] operations) {
        // Write your code here.
    }
}
Checking account…