package leetcode;

/**
 * https://leetcode.com/problems/design-hashmap/
 */
public class Problem706 {
    private static class MyHashMap {

        /** Initialize your data structure here. */
        public MyHashMap() {
            // TODO
        }

        /** value will always be non-negative. */
        public void put(int key, int value) {
            // TODO
        }

        /**
         * Returns the value to which the specified key is mapped, or
         * -1 if this map contains no mapping for the key
         */
        public int get(int key) {
            // TODO
            return 0;
        }

        /**
         * Removes the mapping of the specified value key if this map contains
         * a mapping for the key
         */
        public void remove(int key) {
            // TODO
        }
    }

    public static void main(String[] args) {
        MyHashMap hashMap = new MyHashMap();
        hashMap.put(1, 1);
        hashMap.put(2, 2);
        System.out.println(hashMap.get(1)); // returns 1
        System.out.println(hashMap.get(3)); // returns -1 (not found)
        hashMap.put(2, 1); // update the existing value
        System.out.println(hashMap.get(2)); // returns 1
        hashMap.remove(2); // remove the mapping for 2
        System.out.println(hashMap.get(2)); // returns -1 (not found)
    }
}

@@ -131,16 +131,76 @@
 ashMap %7B
+%0A        private final Integer%5B%5D map = new Integer%5B1000001%5D;
 %0A%0A      
@@ -274,36 +274,16 @@
 Map() %7B%0A
-            // TODO%0A
         
@@ -385,39 +385,49 @@
 ) %7B%0A            
-// TODO
+map%5Bkey%5D = value;
 %0A        %7D%0A%0A    
@@ -624,36 +624,100 @@
     
-// TODO%0A            return 0
+if (map%5Bkey%5D == null) %7B%0A                return -1;%0A            %7D%0A            return map%5Bkey%5D
 ;%0A  
@@ -915,541 +915,88 @@
     
-// TODO%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        MyHashMap hashMap = new MyHashMap();%0A        hashMap.put(1, 1);%0A        hashMap.put(2, 2);%0A        System.out.println(hashMap.get(1)); // returns 1%0A        System.out.println(hashMap.get(3)); // returns -1 (not found)%0A        hashMap.put(2, 1); // update the existing value%0A        System.out.println(hashMap.get(2)); // returns 1%0A        hashMap.remove(2); // remove the mapping for 2%0A        System.out.println(hashMap.get(2)); // returns -1 (not found)
+if (map%5Bkey%5D != null) %7B%0A                map%5Bkey%5D = null;%0A            %7D%0A        %7D
 %0A   

Solve problem 706