Skip to content

Instantly share code, notes, and snippets.

@hkasera
Created June 1, 2020 23:40
Show Gist options
  • Save hkasera/8c41bea5c7a3ee139d9c097cf5639a18 to your computer and use it in GitHub Desktop.
Save hkasera/8c41bea5c7a3ee139d9c097cf5639a18 to your computer and use it in GitHub Desktop.
private boolean sumsToTarget(int[] arr, int k) {
HashSet values = new HashSet();
for (int i = 0; i < arr.length; i++) {
if (values.contains(k - A[i])) return true;
values.add(A[i]);
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment