Two_sum public int[] solution1(int[] nums,int target){HashMap map = new HashMap (); int[] a = new int[2]; for (int i = 0; i nums.length; i++) { int solution = target - nums[i]; if(map.containsKey(solution) map.get(solution)!=i){ a[0] = i; a
public int[] solution1(int[] nums,int target){ HashMapmap = new HashMap (); int[] a = new int[2]; for (int i = 0; i < nums.length; i++) { int solution = target - nums[i]; if(map.containsKey(solution) && map.get(solution)!=i){ a[0] = i; a[1] = map.get(solution); } map.put(nums[i], i); } return a; }