Write a function check_sum(), which, given li, a list of integers, and num, returns whether any two numbers in li add up to num


Write a function check_sum(), which, given li, a list of integers, and num, returns whether any two numbers in li add up to num



Write a function check_sum(), which, given li, a list of integers, and num, returns whether any two numbers in li add up to num. There are no duplicates in li.
Provide a solution that is faster than O(n^2) time.


check_sum()


li


num


li


num


li



Example:


>>> check_sum(li=[11, 1, 2, 3, 10], num=21)
True
>>> check_sum(li=[11, 1, 2, 3], num=21)
False





That's a nice homework description. Now, what's your question?
– cricket_007
Jul 1 at 14:24









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Rothschild family

Cinema of Italy