← Meta Interview Insights

Meta·Software Engineer·Online Assessment (OA)·Senior

Senior
May 2026

Summary

Meta SWE online assessment, one problem focused on extending an in-memory record store to handle timestamps and TTL expiration. Pretty niche design problem, not your typical LeetCode grind.

Questions Asked (1)

Q1

Design and implement an in-memory record store that supports write timestamps and time-to-live (TTL) expiration. Records past their TTL should be invisible during reads and scans.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

This was a level 3 extension of a simpler key-value store problem, so you had to build on top of existing add/remove/scan logic and layer in expiration semantics.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then outline a high-level design using a hash map for storage and a min-heap or timing wheel for TTL management. Discuss read/scan logic to filter expired records, and cover concurrency, persistence, and performance trade-offs.

Pro tip: Mention that you would use a monotonic clock to avoid issues with system time changes, and discuss how to handle TTL expiration lazily versus actively to balance latency and memory usage.

1. Clarify Requirements and Constraints

Ask about expected scale, read/write patterns, TTL granularity, consistency needs, and whether persistence is required. Confirm that expired records should be invisible immediately after TTL.

2. Design Data Model and Storage

Propose a record structure with key, value, write timestamp, and TTL. Use an in-memory hash map for O(1) key access, and consider a secondary index for scans (e.g., sorted by key or timestamp).

3. Implement TTL Expiration Strategy

Choose between lazy expiration (check on read) and active expiration (background sweeper). Discuss using a min-heap or timing wheel to efficiently track and evict expired records.

4. Handle Reads and Scans

For reads, check TTL and return null if expired. For scans, iterate over records and filter out expired ones, possibly using a snapshot or consistent view to avoid concurrent modification issues.

5. Address Concurrency and Performance

Discuss thread-safety using locks or concurrent data structures, and trade-offs between read/write locks, lock-free approaches, and sharding. Mention memory management and potential eviction policies.

Key Points to Mention

  • Use of monotonic clock for TTL to avoid system time adjustments
  • Lazy vs. active expiration and their impact on latency and memory
  • Data structures: hash map for O(1) access, min-heap/timing wheel for TTL
  • Concurrency control: read-write locks, sharding, or lock-free structures
  • Scan implementation: filtering expired records, snapshot isolation
  • Trade-offs: memory overhead, CPU usage, and consistency guarantees

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.