Find all the pairs in array that add up to a certain number?
Sigiloso
h = new HashMap(); for (int i=0; i < a.length; ++i) { h.put(a[i], i); } for (int i=0; i < h.keys.length; ++i) { int match = sum - h.keys[i]; if (h.get(match) != null) { print h.keys[i] + "," + h.keys[match]; } }