PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates understanding of core data structures, API design, complexity analysis, and edge-case handling for an in-memory key–value CRUD store, and falls under the Coding & Algorithms domain while testing both practical implementation skills and conceptual reasoning about time/space trade-offs.

  • Medium
  • DocuSign
  • Coding & Algorithms
  • Software Engineer

Implement a key-value CRUD store

Company: DocuSign

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Implement an in-memory key–value store that supports create, read, update, and delete operations. Expose APIs such as put(key, value), get(key), update(key, value), delete(key), and exists(key). Choose and justify an underlying data structure (e.g., a B-tree or another ordered index) and analyze time and space complexity. Discuss edge cases like overwriting existing keys and missing keys.

Quick Answer: This question evaluates understanding of core data structures, API design, complexity analysis, and edge-case handling for an in-memory key–value CRUD store, and falls under the Coding & Algorithms domain while testing both practical implementation skills and conceptual reasoning about time/space trade-offs.

Implement the behavior of an in-memory key-value store. Since the judge calls a single function rather than individual methods, each API call is represented as an operation in a list. The store must support put(key, value), get(key), update(key, value), delete(key), and exists(key). Use exact-key lookup semantics: a hash map/dictionary is the appropriate underlying data structure because the APIs do not require sorted traversal or range queries. If sorted operations were required, an ordered index such as a B-tree could be justified, but for these operations a hash map provides better expected lookup performance.

Constraints

  • 0 <= len(operations) <= 100000
  • Each operation is valid and uses one of: 'put', 'get', 'update', 'delete', 'exists'
  • Keys and values are non-empty strings with length at most 100
  • Values will not be any reserved output token: 'CREATED', 'OVERWRITTEN', 'UPDATED', 'DELETED', 'NOT_FOUND', 'true', or 'false'

Examples

Input: ([['put','user:1','Alice'], ['get','user:1'], ['exists','user:1'], ['update','user:1','Alicia'], ['get','user:1'], ['delete','user:1'], ['get','user:1'], ['exists','user:1']],)

Expected Output: ['CREATED', 'Alice', 'true', 'UPDATED', 'Alicia', 'DELETED', 'NOT_FOUND', 'false']

Explanation: The key is created, read, updated, deleted, and then no longer exists.

Input: ([['put','a','1'], ['put','a','2'], ['get','a'], ['update','b','3'], ['delete','b'], ['exists','a']],)

Expected Output: ['CREATED', 'OVERWRITTEN', '2', 'NOT_FOUND', 'NOT_FOUND', 'true']

Explanation: The second put overwrites key 'a'. Updating and deleting missing key 'b' both fail.

Input: ([['delete','x'], ['put','x','first'], ['delete','x'], ['put','x','second'], ['get','x']],)

Expected Output: ['NOT_FOUND', 'CREATED', 'DELETED', 'CREATED', 'second']

Explanation: Deleting a missing key returns 'NOT_FOUND'. After deletion, the same key can be created again.

Input: ([],)

Expected Output: []

Explanation: With no operations, the result list is empty.

Input: ([['put','k1','v1'], ['put','k2','v2'], ['update','k1','v3'], ['exists','k2'], ['delete','k2'], ['exists','k2'], ['get','k1']],)

Expected Output: ['CREATED', 'CREATED', 'UPDATED', 'true', 'DELETED', 'false', 'v3']

Explanation: Multiple keys are stored independently. Deleting 'k2' does not affect the updated value of 'k1'.

Hints

  1. Only exact-key operations are required, so think about a structure that can check whether a key exists in expected O(1) time.
  2. Be careful to distinguish put from update: put can overwrite an existing key, while update should fail when the key is missing.
Last updated: Jun 24, 2026

Related Coding Questions

  • Find maximum island sum and required indices - DocuSign (Medium)

Loading coding console...

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.