classMyHashSet{public:/** Initialize your data structure here. */MyHashSet():set(1000001){}voidadd(intkey){set[key]=true;}voidremove(intkey){set[key]=false;}/** Returns true if this set contains the specified element */boolcontains(intkey){returnset[key];}private:vector<bool>set;};
classMyHashSet{/** Initialize your data structure here. */publicMyHashSet(){set=newboolean[1000001];}publicvoidadd(intkey){set[key]=true;}publicvoidremove(intkey){set[key]=false;}/** Returns true if this set contains the specified element */publicbooleancontains(intkey){returnset[key];}privateboolean[]set=newboolean[1000001];}