Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 392 Bytes

706_designHashMap.md

File metadata and controls

27 lines (21 loc) · 392 Bytes

Solution

Code

class MyHashMap {
public:
    int arr[1000001];
    MyHashMap() {
        memset(arr,-1,sizeof(arr));
    }

    void put(int key, int val) {
        arr[key]=val;
    }

    int get(int key) {
        return arr[key];
    }

    void remove(int key) {
          arr[key]=-1;
    }
};