class MyHashMap {
int[] arr;
public MyHashMap() {
arr = new int[(int) Math.pow(10,6)+1];
Arrays.fill(arr,-1);
}
public void put(int key, int value) {
arr[key] = value;
}
public int get(int key) {
return arr[key];
}
public void remove(int key) {
arr[key] = -1;
}
}
/**
* Your MyHashMap object will be instantiated and called as such:
* MyHashMap obj = new MyHashMap();
* obj.put(key,value);
* int param_2 = obj.get(key);
* obj.remove(key);
*/
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter