FastPrepMutable Table Aggregations
Problems/Mutable Table Aggregations

Mutable Table Aggregations

Notion logoNotion● MediumFULLTIMEPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reports describe table aggregation by table ID with COUNT, SUM, and AVERAGE several times. Follow-ups cover keeping the maximum up to date, row updates, caching, or versioning. We chose the row IDs and the exact format, since the reports leave out the interface details.

Our version is about 93% the same as the reported questions.

Maintain integer-valued rows across independent tables. Process these operations:

  • ["ADD", tableId, rowId, value] inserts a new row.
  • ["UPDATE", tableId, rowId, value] replaces an existing row's value.
  • ["DELETE", tableId, rowId] removes an existing row.
  • ["QUERY", tableId] returns count|sum|average|max for that table.

Format a non-empty table's average with exactly two digits after the decimal point. For an empty table, return 0|0|0.00|NULL. Return the values produced by QUERY operations in order.

Function

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

Examples

Example 1

operations = [["ADD","docs","r1","10"],["ADD","docs","r2","20"],["QUERY","docs"],["UPDATE","docs","r1","40"],["QUERY","docs"],["DELETE","docs","r2"],["QUERY","docs"]]return = ["2|30|15.00|20","2|60|30.00|40","1|40|40.00|40"]

The first query aggregates two rows. Updating r1 changes sum, average, and maximum; deleting r2 leaves one row.

Constraints

  • 1 <= operations.length <= 20000.
  • Table and row IDs are non-empty ASCII strings containing neither | nor whitespace.
  • Values are decimal integers in [-10^9, 10^9].
  • An ADD row ID is absent from that table; an UPDATE or DELETE row ID is present.
  • Every table contains at most 10000 rows, and every sum fits a signed 64-bit integer.

More Notion interview questions

  • Nested Todo ListPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Block Type with the Most ChildrenPHONE SCREEN · Seen Mar 2026
  • Country with the Most EventsPHONE SCREEN · Seen Mar 2026
  • Event Type with the Most EventsPHONE SCREEN · Seen Mar 2026
  • Most Popular Active Plan for the Top Event TypePHONE SCREEN · Seen Mar 2026
  • Page Permission InheritancePHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Percentage of Blocks Never EditedPHONE SCREEN · Seen Mar 2026
  • Text Document HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Versioned Document StorePHONE SCREEN · Seen Apr 2025
  • Top Error Types in a Time WindowONSITE INTERVIEW · Seen Jun 2026

Similar questions at other companies

  • File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
  • Mutable Points in a Hash Set and a ListMillennium · PHONE SCREENMillennium interview questions
  • Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Rectangle Point Coverage CountsOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions
  • Hash Map with Separate ChainingApplied Intuition · ONSITE INTERVIEWApplied Intuition interview questions
  • Camel CardsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions

Notion interview experiences

  • Notion Interviews, Level Not Reported: 20 Experiences
  • Notion Experienced SWE Interviews: 7 Experiences
  • Notion SWE New Grad Interviews: 3 Experiences
  • Notion SWE Intern Interviews and Debugging Round: 6 Experiences
  • Notion New Grad SWE Onsite Invitations: 2 Experiences
All Notion interview questionsSee Notion hiring insights
Saved
class Solution {
    public String[] runTableAggregations(String[][] operations) {
        // Write your code here.
    }
}
Checking account…