Is there a way to do this without sorting the array?

  • 0

    If we can't sort the array, then I thought maybe this can be approached like the 2-sum problem, except the target sum is now all the possible negative complements of the array (stored in a hash table). However, I can't figure out how to do this without causing duplicates. Anyone figured out how to do that?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.