-1
$\begingroup$

The array max size is 10^5 I can only imagine on trying every possibility, on a O(n^2) solution, there is a better way for solving that? Thanks a lot!

$\endgroup$
  • $\begingroup$ How long does it take to create a sorted array? $\endgroup$ – gnasher729 Jan 17 '18 at 22:40
-1
$\begingroup$

I've found the better solution on this link https://www.geeksforgeeks.org/write-a-c-program-that-given-a-set-a-of-n-numbers-and-another-number-x-determines-whether-or-not-there-exist-two-elements-in-s-whose-sum-is-exactly-x/

$\endgroup$
  • $\begingroup$ Please include a relevant snippet from the link as links often go bad and this answer will no longer have any value if that happens. $\endgroup$ – user1118321 Jan 17 '18 at 3:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.