Problem · Hash Table
Design HashMap
Learn this problemProblem statement
Process put, get, and remove operations without using a built-in hash-table implementation for the stored map. Get returns the value or -1 when absent. Return "null" for put and remove operations.
Function
runHashMap(operations: String[], keys: int[], values: int[]) → String[]Examples
Example 1
operations = ["put","put","get","get","put","get","remove","get"]keys = [1,2,1,3,2,2,2,2]values = [1,2,0,0,1,0,0,0]return = ["null","null","1","-1","null","1","null","-1"]The second put updates key 2, and remove makes its later get return -1.
Constraints
- All arrays have equal non-zero length.
0 <= key <= 10000000 <= value <= 1000000- There are at most
100000operations.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024