pranay_teja
11/18/2018 - 9:25 AM

CustomHashsetClass

// https://leetcode.com/explore/learn/card/hash-table/182/practical-applications/1139/

class MyHashSet {
public:
    MyHashSet(): h(1000000, false) {
    
    }
    
    void add(int key) {
        h[key]=true;
    }
    
    void remove(int key) {
        h[key]=false;
    }
    
    bool contains(int key) {
        return h[key];
    }
private:
    vector<bool> h;
};