FastPrepRestaurant Waitlist
Problems/Restaurant Waitlist

Restaurant Waitlist

Google logoGoogle● HardNEW GRADINTERNPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives add, delete, and serve operations and stresses stating your assumptions. We defined the party fields, first-in-first-out matching, and finite rules for running it. Our version is about 91% the same as the reported question.

Process operations against an initially empty restaurant waitlist.

  • JOIN id size adds a party with a unique string ID and positive party size to the back of the waitlist.
  • DELETE id removes the named party, which is guaranteed to be waiting.
  • SERVE tableSize removes and returns the earliest still-waiting party whose size is at most tableSize. Return NONE when no party fits.

Only SERVE operations produce output. Return those party IDs in operation order.

Function

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

Examples

Example 1

operations = [["JOIN","A","4"],["JOIN","B","2"],["JOIN","C","6"],["SERVE","3"],["DELETE","A"],["SERVE","6"],["SERVE","10"]]return = ["B","C","NONE"]

Party B is the first party that fits a table of size 3. After deleting A, party C is served next.

Example 2

operations = [["JOIN","P1","5"],["JOIN","P2","2"],["JOIN","P3","2"],["SERVE","2"],["SERVE","5"]]return = ["P2","P1"]

P2 is earlier than P3 among parties that fit size 2. The next table can seat the earlier remaining party P1.

Constraints

  • 1 <= operations.length <= 100000.
  • Party IDs contain letters or digits, have length from 1 through 20, and are unique across the entire operation sequence.
  • Party sizes and table sizes are integers from 1 through 100000.
  • Every DELETE operation names a currently waiting party.

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

  • Durable Work Queue OperationsOpenAI · PHONE SCREEN · ONSITE INTERVIEW
  • Dynamic Least-Loaded Job DispatcherCresta · PHONE SCREEN
  • Dynamic Fixed-K Score LeaderboardCoinbase · ONSITE INTERVIEW
  • Key-Value Store GET and PUT QPSDatabricks · PHONE SCREEN
  • Matching Engine with Order CancellationIMC Trading · ONSITE INTERVIEW
  • Transaction Authorizer with Velocity RulesGoldman Sachs · ONSITE INTERVIEW
  • Dynamic Fixed-K Score LeaderboardAnchorage · PHONE SCREEN
  • Rate Limiter with a Sliding Window per ClientStackAdapt · PHONE SCREEN
  • Per-Client API Rate LimiterDocker · PHONE SCREEN
  • Sliding Window Rate LimiterLotusFlare · ONSITE INTERVIEW
See Google hiring insights
Saved
class Solution {
    public String[] processWaitlist(String[][] operations) {
        // Write your code here.
    }
}
Checking account…