原题目:https://leetcode-cn.com/problems/design-hashset/
我这确实是哈希【手动狗头】
代码:
class MyHashSet {
vector<bool> tmp;
public:
/** Initialize your data structure here. */
MyHashSet() :tmp(vector<bool> (1000001)){
}
void add(int key) {
tmp[key] = true;
}
void remove(int key) {
tmp[key] = false;
}
/** Returns true if this set contains the specified element */
bool contains(int key) {
return tmp[key];
}
};