Design HashMap
Updated
Problem 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 Online Assessment questions
- 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
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Student and Course EnrollmentWells Fargo · OAWells Fargo interview questions
- Design an Ordered StreamBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Design Hash MapGoldman Sachs · OAGoldman Sachs interview questions
- For All Intents And Purposes Part 1 - Initializing the System 🏗️Stripe · OAStripe interview questions
- Overheat Prevention ControllerOptiver · OAOptiver interview questions
- Out-of-Order Bank Ledger BalancesPerplexity AI · OAPerplexity AI interview questions
- LFU CacheSnowflake · OA · ONSITE INTERVIEWSnowflake interview questions
- Corporate Card Expense RulesRippling · OA · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
- Least Recently Used CacheMicrosoft · OA · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
- Parcel Attribute Store with TTLAirbnb · OAAirbnb interview questions