← ZipRecruiter Interview Insights

ZipRecruiter·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
May 2026Remote

Summary

Ziprecruiter software engineer interview that was basically one big design problem around an in-memory key-value store. They started with the base operations and kept layering on requirements, TTL being the main one. Decent round, more nuanced than I expected.

Questions Asked (3)

Q1

Design an in-memory key-value store where each key maps to a set of field-value pairs. Support operations like set, get, scan (returns all pairs sorted lexicographically by field), and scan_by_prefix.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

The base problem felt manageable.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a data model using a hash map for keys and a sorted structure (e.g., balanced BST or skip list) for fields to support efficient scans. Discuss trade-offs between different data structures and outline the core operations with their time complexities.

Pro tip: Mention that scan and scan_by_prefix can be optimized by storing fields in a sorted order, and consider using a trie for prefix scans if the field set is large. Also, discuss concurrency and memory management as potential extensions.

1. Clarify Requirements

Ask about expected scale, read/write ratio, concurrency needs, and whether persistence is required. Confirm that fields within a key are unique and that scans should return results in lexicographical order.

2. Design Data Model

Propose a two-level structure: a hash map from keys to a collection of field-value pairs, where the collection is sorted by field (e.g., a balanced BST, skip list, or sorted array). For prefix scans, consider an auxiliary trie or a sorted structure that supports range queries.

3. Implement Operations

Detail set (insert or update field-value pair), get (retrieve value for a field), scan (iterate over all fields in sorted order), and scan_by_prefix (iterate over fields with a given prefix). Discuss time complexities: set/get O(1) or O(log n) depending on structure, scan O(n), scan_by_prefix O(log n + k) where k is number of matches.

4. Discuss Trade-offs and Optimizations

Compare using a balanced BST vs. a skip list vs. a sorted array for the field collection. For scan_by_prefix, discuss using a trie or binary search on a sorted array. Mention memory overhead and concurrency considerations (e.g., locking, copy-on-write).

5. Conclude and Extend

Summarize the design, highlighting its strengths and weaknesses. Suggest possible extensions like TTL, persistence, or distributed scaling if relevant to the role.

Key Points to Mention

  • Choice of data structure for the inner map: balanced BST (e.g., red-black tree) or skip list for O(log n) operations and sorted iteration.
  • For scan_by_prefix, using a trie or binary search on a sorted array to achieve efficient prefix matching.
  • Time and space complexity analysis for each operation, including worst-case and average-case.
  • Handling updates and deletions while maintaining sorted order.
  • Concurrency control mechanisms (e.g., read-write locks, sharding) if the store is to be thread-safe.
  • Memory management and potential optimizations like compression or lazy deletion.

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

Q2

Now add TTL support. Each set operation takes a timestamp and a TTL value. Fields should expire after TTL time units from the timestamp, and reads or scans at time t should ignore any field whose expiration is at or before t. Re-setting a field should replace both its value and expiration.

System DesignTechnical Trade-offsData Modeling
Author's notes

This is where things got interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data model and API changes: each field now stores a value and an expiration timestamp (timestamp + TTL). Then describe how reads and scans filter out expired fields, and how set operations overwrite both value and expiration. Finally, discuss trade-offs like lazy vs. eager expiration and memory implications.

Pro tip: Mention that expiration should be checked at read time using the provided timestamp, not wall-clock time, to ensure consistency in distributed or test scenarios. Also note that lazy expiration avoids background overhead but may leave stale data until accessed.

1. Clarify requirements and data model

Confirm that each field stores a value and an expiration timestamp (timestamp + TTL). Re-setting a field replaces both value and expiration.

2. Design read and scan behavior

At read/scan time t, ignore any field whose expiration <= t. This requires checking expiration on every access.

3. Handle set operations

On set, compute expiration = timestamp + TTL and store it with the value, overwriting any previous value and expiration.

4. Choose expiration strategy

Decide between lazy expiration (check on read) and eager expiration (background cleanup). Discuss trade-offs in latency, memory, and complexity.

5. Discuss edge cases and trade-offs

Consider TTL=0 (immediate expiration), negative TTL, clock skew, and how scans handle large datasets with many expired fields.

Key Points to Mention

  • Store expiration as an absolute timestamp (timestamp + TTL) to avoid recomputation.
  • Reads and scans must filter based on the provided time t, not current wall-clock time.
  • Re-setting a field overwrites both value and expiration, effectively resetting TTL.
  • Lazy expiration vs. eager expiration: lazy is simpler but may leave stale data; eager requires background cleanup.
  • Memory implications: expired fields may still occupy space until cleaned up.
  • Edge cases: TTL=0 means immediate expiration; negative TTL should be handled or rejected.

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

Q3

Walk through the trade-offs between lazy expiration (skip expired fields on read) versus active expiration (background sweep that evicts expired entries). How does each approach affect memory usage and latency?

Technical Trade-offsSystem Design
Author's notes

I leaned toward lazy expiration and explained it pretty well.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining both expiration strategies clearly, then compare them across memory usage, latency, and operational complexity. Use a concrete example like a cache or session store to illustrate the trade-offs, and conclude with when to choose each approach or a hybrid.

Pro tip: Mention that real systems often use a hybrid: lazy expiration for reads plus periodic active sweeps to bound memory, and note that active expiration can be tuned to avoid latency spikes by running incrementally or during low traffic.

1. Define the strategies

Briefly explain lazy expiration (check on access) and active expiration (background sweep) so the interviewer knows you understand the basics.

2. Analyze memory impact

Compare how each affects memory: lazy can leave expired items consuming memory until accessed, while active frees memory promptly but adds overhead.

3. Analyze latency impact

Discuss how lazy expiration adds per-read overhead (checking expiry) but avoids background load, while active expiration can cause latency spikes during sweeps but keeps reads fast.

4. Consider operational factors

Mention implementation complexity, CPU usage, and the ability to tune each approach (e.g., sweep frequency, sampling).

5. Recommend a hybrid or context-specific choice

Conclude with when to use each or a combination, based on workload characteristics like read/write ratio and memory constraints.

Key Points to Mention

  • Memory usage: lazy expiration can lead to memory bloat if expired items are rarely accessed; active expiration reclaims memory promptly but requires additional CPU and memory for tracking.
  • Latency: lazy expiration adds a small overhead to each read (checking expiry) but no background latency; active expiration can cause periodic latency spikes during sweeps, though modern implementations use incremental sweeping to mitigate this.
  • Throughput and CPU: active expiration consumes CPU cycles in the background, potentially competing with foreground operations; lazy expiration defers cost to access time.
  • Implementation complexity: active expiration requires a background process, scheduling, and careful concurrency handling; lazy expiration is simpler to implement.
  • Use cases: lazy expiration works well for caches with high read rates and tolerable memory overhead; active expiration is better for memory-constrained environments or when expired data must be removed promptly (e.g., compliance).
  • Hybrid approach: many systems (e.g., Redis) combine both: lazy on access and periodic active sweeps to bound memory.

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