Maintain a Live Filtered and Sorted View Under Record Updates

Last updated: November 29, 2026

Quick Overview

Build a structure that keeps a view's visible records filtered and sorted as records are inserted, edited and deleted. Each update must return the minimal change for clients (insert at index, remove at index, or move from one index to another) without re-sorting the whole view.

Airtable
Coding & Algorithms
Software Engineer
Airtable
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Build a structure that keeps a view's visible records filtered and sorted as records are inserted, edited and deleted. Each update must return the minimal change for clients (insert at index, remove at index, or move from one index to another) without re-sorting the whole view.

Airtable keeps each base in memory and pushes changes to every collaborator in real time, so views must update incrementally rather than being recomputed per edit. The interviewer is testing data-structure choice, correct index bookkeeping, and the reasoning about what the client actually needs.

What the Interviewer Expects
  • Explain why full re-sorting on every edit does not scale
  • Keep a sorted structure keyed by (sort key, record id) so ties are deterministic
  • Handle all four transitions: enter, leave, move, no-op
  • Report indices that match how the client applies changes
  • Discuss a balanced tree or skip list for O(log n) inserts
Key Topics to Cover
Incremental view maintenance
Binary search
Ordered sets
Real-time sync
Diffing
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you batch 500 edits from a CSV import into one client update?
  • How do you keep a user's own row from jumping away while they are still editing it?
  • How would grouping by a field change the structure?
  • How would you make the view lazily materialize when only the first 100 rows are on screen?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Given a predicate and a sort key, process upsert(id, fields) and delete(id). Output one of insert(id, idx), remove(id, idx), move(id, old, new) or nothing. Ties break on record id so every c...

High-Level Design

Store a sorted list of (key, id) and a map id -> key. The map is required: to find a row's old position you need its old key, because the fields passed in are already the new values. Four cases: n...


Submit Your Answer
Markdown supported

Related Questions