PracHub
QuestionsLearningGuidesInterview Prep
|Home/Coding & Algorithms/Rbcroyalbank

Process Operations for an In-Memory Key-Value Store

Last updated: Jul 22, 2026

Quick Overview

Implement a simple in-memory key-value store from a stream of SET, GET, and DELETE operations. This coding exercise checks hash-map updates, replacement and missing-key semantics, ordered query output, and expected constant-time processing at scale.

  • medium
  • Rbcroyalbank
  • Coding & Algorithms
  • Machine Learning Engineer

Process Operations for an In-Memory Key-Value Store

Company: Rbcroyalbank

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

# Process Operations for an In-Memory Key-Value Store Implement an in-memory key-value store that supports adding or replacing a value, deleting a key, and querying a key. ```python def process_operations(operations: list[list[str]]) -> list[str]: ... ``` Each operation has one of these forms: - `["SET", key, value]`: store `value` under `key`, replacing the previous value if the key already exists. - `["DELETE", key]`: remove `key` if it exists. Deleting a missing key is a no-op. - `["GET", key]`: append the current value to the result, or append `"NULL"` if the key is absent. Return the results of the `GET` operations in encounter order. Keys and values are case-sensitive strings. The literal value `"NULL"` will not appear in a `SET` operation. ## Constraints - `0 <= len(operations) <= 200_000` - `1 <= len(key), len(value) <= 100` - Every operation has the exact arity shown above. - Aim for expected constant time per operation and linear time overall. ## Examples ```text Input: operations = [ ["SET", "model", "v1"], ["GET", "model"], ["SET", "model", "v2"], ["GET", "model"], ["DELETE", "model"], ["GET", "model"] ] Output: ["v1", "v2", "NULL"] ``` ```text Input: operations = [["DELETE", "missing"], ["GET", "missing"]] Output: ["NULL"] ```

Quick Answer: Implement a simple in-memory key-value store from a stream of SET, GET, and DELETE operations. This coding exercise checks hash-map updates, replacement and missing-key semantics, ordered query output, and expected constant-time processing at scale.

|Home/Coding & Algorithms/Rbcroyalbank

Process Operations for an In-Memory Key-Value Store

Rbcroyalbank logo
Rbcroyalbank
Jul 6, 2026, 12:00 AM
mediumMachine Learning EngineerTechnical ScreenCoding & Algorithms
0
0

Process Operations for an In-Memory Key-Value Store

Implement an in-memory key-value store that supports adding or replacing a value, deleting a key, and querying a key.

def process_operations(operations: list[list[str]]) -> list[str]:
    ...

Each operation has one of these forms:

  • ["SET", key, value] : store value under key , replacing the previous value if the key already exists.
  • ["DELETE", key] : remove key if it exists. Deleting a missing key is a no-op.
  • ["GET", key] : append the current value to the result, or append "NULL" if the key is absent.

Return the results of the GET operations in encounter order. Keys and values are case-sensitive strings. The literal value "NULL" will not appear in a SET operation.

Constraints

  • 0 <= len(operations) <= 200_000
  • 1 <= len(key), len(value) <= 100
  • Every operation has the exact arity shown above.
  • Aim for expected constant time per operation and linear time overall.

Examples

Input:
operations = [
  ["SET", "model", "v1"],
  ["GET", "model"],
  ["SET", "model", "v2"],
  ["GET", "model"],
  ["DELETE", "model"],
  ["GET", "model"]
]

Output: ["v1", "v2", "NULL"]
Input:
operations = [["DELETE", "missing"], ["GET", "missing"]]

Output: ["NULL"]

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Rbcroyalbank•More Machine Learning Engineer•Rbcroyalbank Machine Learning Engineer•Rbcroyalbank Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding 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.