FastPrepImplement an Unordered Map
Problems/Implement an Unordered Map

Implement an Unordered Map

Old Mission logoOld Mission● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Old Mission phone screen for a full-time role. The report names the task of implementing an unordered map. It leaves out which methods are needed and how it is run. We filled those in.

Our version is about 80% the same as the reported question.

Implement an integer key-value map without using a language-provided map, dictionary, or hash-table type.

Process the operations in order:

  • put with arguments [key, value] inserts the key or replaces its current value.
  • get with arguments [key] appends the current value to the result, or -1 when the key is absent.
  • remove with arguments [key] erases the key when it is present and otherwise does nothing.

Return the results of the get operations in their original order.

Your implementation should use hashing, resolve collisions correctly, and provide expected constant-time operations.

Function

runUnorderedMap(operations: String[], arguments: int[][]) → int[]

Examples

Example 1

operations = ["put","put","get","put","get","remove","get"]arguments = [[1,10],[2,20],[1],[1,15],[1],[2],[2]]return = [10,15,-1]

The first get(1) returns 10. Updating key 1 makes the next lookup return 15. After removing key 2, its lookup returns -1.

Example 2

operations = ["get","put","put","get","remove","get"]arguments = [[-5],[-5,7],[11,4],[-5],[-5],[-5]]return = [-1,7,-1]

Negative keys are valid. The missing key first produces -1, then stores 7, and becomes absent again after removal.

Constraints

  • 1 <= operations.length == arguments.length <= 200000
  • Each operation is put, get, or remove.
  • A put argument has length 2; the other argument arrays have length 1.
  • -10^9 <= key <= 10^9
  • 0 <= value <= 10^9
  • Do not use a built-in map, dictionary, or hash-table implementation.

More Old Mission interview questions

  • Restricted JSON ParserPHONE SCREEN · Seen May 2025
  • Merging PalindromesOA · Seen Mar 2024

Similar questions at other companies

  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
  • Mutable Points in a Hash Set and a ListMillennium · PHONE SCREENMillennium interview questions
  • Rectangle Point Coverage CountsOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions
  • Camel CardsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Return Every Matching DecryptionDuolingo · PHONE SCREENDuolingo interview questions
  • Corporation Reporting LinesMicrosoft · PHONE SCREENMicrosoft interview questions
  • Key-Value Store on a Block DeviceLambda · PHONE SCREEN

Interview reports that mention this question

  • Old Mission SWE OA and Interview Questions: 14 Experiences

Old Mission interview experiences

  • Old Mission Quant Trader and New Grad OA Questions: 7 Experiences
  • Old Mission Junior Quant Trader OA Guide
See Old Mission hiring insights
Saved
class Solution {
    public int[] runUnorderedMap(String[] operations, int[][] arguments) {
      // Write your code here.
    }

}
Checking account…