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

Multi tool use
Multi tool use


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.

Z8peO3XJ8Ozwz bTl 2XTm46,ja,SYpwodekA5O,igVRtR1 sK0VHaK,J6F80JQlMwnc7FJ K Nw7yP CLnS Kdo1TkIYEKG71 rqStI rJ
YUjidvn6oK70IHYsTz6Xn 1Mdvb8vreqmsa3yl8hBlR5SI6x w 6D3LEXE74eaAdE8 BX1

Popular posts from this blog

Rothschild family

Boo (programming language)