PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Notion

Implement Table Aggregation

Last updated: Apr 19, 2026

Quick Overview

This question evaluates a candidate's ability to perform data aggregation and manipulate basic data structures by grouping records by key and combining numeric values.

  • easy
  • Notion
  • Coding & Algorithms
  • Software Engineer

Implement Table Aggregation

Company: Notion

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

You are given a table represented as a list of rows. Each row contains: - `key`: a string identifying a group - `value`: an integer Write a function that aggregates the table by `key` and returns, for each distinct key, the sum of all corresponding `value`s. Example: Input rows: - `(A, 3)` - `(B, 5)` - `(A, 2)` - `(B, 1)` - `(C, 4)` Output: - `(A, 5)` - `(B, 6)` - `(C, 4)` The output may be returned in any order unless otherwise specified. Follow-up discussion: 1. How would you extend the implementation so that it can support other aggregation functions such as `MAX` in addition to `SUM`? 2. If the table is too large to fit into memory, how would you process it efficiently?

Quick Answer: This question evaluates a candidate's ability to perform data aggregation and manipulate basic data structures by grouping records by key and combining numeric values.

Related Interview Questions

  • Find Top Errors in Time Window - Notion (medium)
  • Implement a DAG task graph - Notion (medium)
  • Implement text editor with undo/redo - Notion (Medium)
  • Design a text editor with undo/redo - Notion (Medium)
Notion logo
Notion
Feb 1, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
31
0

You are given a table represented as a list of rows. Each row contains:

  • key : a string identifying a group
  • value : an integer

Write a function that aggregates the table by key and returns, for each distinct key, the sum of all corresponding values.

Example:

Input rows:

  • (A, 3)
  • (B, 5)
  • (A, 2)
  • (B, 1)
  • (C, 4)

Output:

  • (A, 5)
  • (B, 6)
  • (C, 4)

The output may be returned in any order unless otherwise specified.

Follow-up discussion:

  1. How would you extend the implementation so that it can support other aggregation functions such as MAX in addition to SUM ?
  2. If the table is too large to fit into memory, how would you process it efficiently?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Notion•More Software Engineer•Notion Software Engineer•Notion Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.