We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 570a498 commit c6544b2Copy full SHA for c6544b2
src/main/java/com/fishercoder/solutions/_706.java
@@ -1,5 +1,7 @@
1
package com.fishercoder.solutions;
2
3
+import java.util.Arrays;
4
+
5
public class _706 {
6
public static class Solution1 {
7
/**
@@ -163,4 +165,31 @@ public void remove(int key) {
163
165
}
164
166
167
168
169
+ public static class Solution3 {
170
+ /**
171
+ * My completely original, but hacky and cheaty solution to take full advantage of the problem constraints.
172
+ */
173
+ public static class MyHashMap {
174
175
+ int[] map;
176
177
+ public MyHashMap() {
178
+ map = new int[1000001];
179
+ Arrays.fill(map, -1);
180
+ }
181
182
+ public void put(int key, int value) {
183
+ map[key] = value;
184
185
186
+ public int get(int key) {
187
+ return map[key];
188
189
190
+ public void remove(int key) {
191
+ map[key] = -1;
192
193
194
195
0 commit comments