706-design-hashmap

DevGod
Vtuber
var MyHashMap = function() { this.data = {};};
/** * @param {number} key * @param {number} value * @return {void} */MyHashMap.prototype.put = function(key, value) { this.data[key] = value;};
/** * @param {number} key * @return {number} */MyHashMap.prototype.get = function(key) { if(this.data[key] === undefined){ return -1; } return this.data[key];};
/** * @param {number} key * @return {void} */MyHashMap.prototype.remove = function(key) { this.data[key] = undefined;};
/** * Your MyHashMap object will be instantiated and called as such: * var obj = new MyHashMap() * obj.put(key,value) * var param_2 = obj.get(key) * obj.remove(key) */