aboutsummaryrefslogtreecommitdiff
path: root/design_hashmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'design_hashmap.cpp')
-rw-r--r--design_hashmap.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/design_hashmap.cpp b/design_hashmap.cpp
new file mode 100644
index 0000000..6b7ce3d
--- /dev/null
+++ b/design_hashmap.cpp
@@ -0,0 +1,12 @@
+#include "leetcode.h"
+
+class MyHashMap {
+public:
+ int data[1000001];
+ MyHashMap() { fill(data, data + 1000000, -1); }
+ void put(int key, int value) { data[key] = value; }
+ int get(int key) { return data[key]; }
+ void remove(int key) { data[key] = -1; }
+};
+
+int main() {}