FastPrepDesign HashMap
Problems/Design HashMap

Design HashMap

The Walt Disney Company logoThe Walt Disney Company● EasyFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report names a phone-screen task to design a hashmap. It does not supply an API, key/value types, bounds, collision strategy or test cases. This practice supplies an integer put/get/remove interface, operation-array adapter, nonnegative value domain, missing sentinel and explicit no-built-in-mapping implementation rule. Direct addressing and separate chaining illustrate two valid representations. About 70% of the reported task scope is represented, as an editorial estimate rather than recovered original detail.

Implement an integer-key HashMap and process the given operations in order, starting with an empty map.

For this exercise, each row is [kind,key,value]. Kind 0 puts the key/value pair, replacing any previous value, and returns 0. Kind 1 gets the current value or returns -1 if absent. Kind 2 removes the key if present and returns 0. The third field is ignored for get and remove. Return one answer for every operation.

Build the mapping yourself using arrays or lists; do not use a built-in hash map, dictionary or set. The operation encoding, numeric bounds and acknowledgement values are practice conventions.

Function

runHashMap(operations: int[][]) → int[]

Examples

Example 1

operations = [[0,7,11],[1,7,0],[1,8,0],[0,7,4],[1,7,0],[2,7,0],[1,7,0]]return = [0,11,-1,0,4,0,-1]

The first put stores 11 at key 7. The missing key 8 returns -1. Replacing key 7 yields 4; removing it makes the last get return -1. Mutations each return 0.

Example 2

operations = [[0,1,9],[0,102,6],[2,1,0],[1,102,0],[1,1,0]]return = [0,0,0,6,-1]

Keys 1 and 102 have the same remainder modulo 101 but are distinct. Removing 1 preserves the value 6 at key 102.

Constraints

  • 0 <= operations.length <= 1000
  • operations[i].length == 3
  • 0 <= operations[i][j] <= 1000000
  • Operation kinds are 0, 1 or 2; keys are at most 10000.
  • Implement the mapping without built-in hash maps, dictionaries or sets. Arrays and lists are allowed.

More The Walt Disney Company problems

  • Find All Paths for a Name in a File SystemPHONE SCREEN · Seen Nov 2026
  • Resizable Array-Backed Integer SetPHONE SCREEN · Seen Sep 2026
  • Shortest Path with Directional Move CostsPHONE SCREEN · Seen Sep 2026
All The Walt Disney Company interview questionsSee The Walt Disney Company hiring insights
Saved
class Solution {
    public int[] runHashMap(int[][] operations) {
        // Write your code here
    }
}
Checking account…