@@ -0,0 +1,963 @@
+import java.util.*;%0A%0Apublic class Solution %7B%0A  class Element %7B%0A    int index, value;%0A    public Element(int index, int value) %7B%0A      this.index = index;%0A      this.value = value;%0A    %7D%0A  %7D%0A%0A  public int%5B%5D twoSum(int%5B%5D numbers, int target) %7B%0A    Map%3CInteger, Element%3E values = new HashMap%3CInteger, Element%3E();%0A    int%5B%5D answer = new int%5B0%5D;%0A    for (int i = 0; i %3C numbers.length; i++) %7B%0A      int number = numbers%5Bi%5D;%0A      Element other = values.get(target - number);%0A      if (other != null) %7B%0A        answer = new int%5B%5D %7B i + 1, other.index %7D;%0A        break;%0A      %7D%0A      values.put(number, new Element(i + 1, number));%0A    %7D%0A%0A    Arrays.sort(answer);%0A    return answer;%0A  %7D%0A%0A  public static void main(String%5B%5D _) %7B%0A    Solution s = new Solution();%0A    print(s.twoSum(new int%5B%5D %7B 2, 7, 11, 15 %7D, 9));%0A  %7D%0A%0A  static void print(int%5B%5D ints) %7B%0A    for (int i: ints) %7B%0A      System.out.print(i);%0A      System.out.print(' ');%0A    %7D%0A    System.out.println();%0A  %7D%0A%7D%0A

Solve two-sum