@@ -0,0 +1,830 @@
+package LeeCode;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A/*%0AGiven an array of integers, return indices of the two numbers such that they add up to a specific target.%0A%0AYou may assume that each input would have exactly one solution, and you may not use the same element twice.%0A%0AExample:%0AGiven nums = %5B2, 7, 11, 15%5D, target = 9,%0A%0ABecause nums%5B0%5D + nums%5B1%5D = 2 + 7 = 9,%0Areturn %5B0, 1%5D.%0A*/%0Apublic class TwoSum %7B%0A    public int%5B%5D twoSum(int%5B%5D nums, int target) %7B%0A        int%5B%5D tmp = new int%5B2%5D;%0A        Map%3CInteger, Integer%3E map = new HashMap%3CInteger, Integer%3E();%0A        for (int i = 0; i %3C nums.length; i++)%7B%0A            if(map.containsKey(target - nums%5Bi%5D))%7B%0A                tmp%5B1%5D = i;%0A                tmp%5B0%5D = map.get(target - nums%5Bi%5D);%0A            %7D%0A            map.put(nums%5Bi%5D, i);%0A        %7D%0A        return tmp;%0A    %7D%0A%7D%0A

add two sum problem into LeeCode