← ZipRecruiter Interview Insights

ZipRecruiter·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026Remote

Summary

Coding round at Ziprecruiter where the whole session was basically one design problem: build an in-memory key-value store that supports nested fields and a handful of operations. More implementation-heavy than algorithmic, which I didn't fully expect.

Questions Asked (1)

Q1

Design and implement an in-memory key-value store class where each key can hold multiple named fields. The class must support set(key, field, value), get(key, field), setAndCompare(key, field, value, threshold), and setAndDelete(key, field, value, condition). Define return values for missing keys and fields, and explain your choice of underlying data structure.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

I went with a dict-of-dicts pretty quickly and they seemed fine with that.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and edge cases, then propose a nested hash map (e.g., HashMap<String, HashMap<String, String>>) as the core data structure. Walk through each method's implementation, defining clear return values for missing keys/fields, and discuss the semantics of the conditional operations. Finally, analyze time and space complexity and mention possible optimizations or trade-offs.

Pro tip: Explicitly define the behavior for missing keys/fields (e.g., return null or throw an exception) and be consistent; this shows attention to API design and error handling. Also, discuss thread-safety if the interviewer hints at concurrency, as it's a common follow-up.

1. Clarify Requirements and Edge Cases

Ask questions to understand expected behavior: What should get return if key or field is missing? Should set overwrite existing values? What are the exact semantics of setAndCompare and setAndDelete? Are there concurrency requirements?

2. Choose Data Structure

Propose a nested map: outer map from key to inner map, inner map from field to value. Justify why this gives O(1) average time for get/set and is memory-efficient for sparse fields.

3. Implement Core Methods

Describe set and get: set inserts or updates the field value; get retrieves the value or returns null (or a sentinel) if key/field missing. Mention handling of null keys/fields if necessary.

4. Implement Conditional Methods

For setAndCompare: compare current value with threshold (e.g., numeric comparison) and set only if condition holds; return boolean indicating success. For setAndDelete: if current value meets condition, delete the field and return true; else return false. Clarify condition semantics (e.g., equals, greater than).

5. Analyze Complexity and Trade-offs

State that all operations are O(1) average time, O(n) worst-case for hash collisions. Discuss memory overhead of nested maps and potential alternatives (e.g., single map with composite keys) and their trade-offs.

Key Points to Mention

  • Use of nested HashMap for O(1) average-time operations
  • Clear return value conventions for missing keys/fields (e.g., null or Optional)
  • Semantics of setAndCompare: atomic compare-and-set with threshold
  • Semantics of setAndDelete: conditional deletion based on value condition
  • Time and space complexity analysis
  • Potential thread-safety considerations (e.g., synchronized methods or ConcurrentHashMap)

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