Jump to content

Talk:Weird numbers: Difference between revisions

Line 25:
def anySum(n, xs):
'''First subset of xs found to sum to n.
(Probably more efficient where the xs areis sorted in descending
order of magnitude)'''
def go(n, xs):
Line 46:
 
print(anySum(7, [1,1,1,1,1,6]))
# -> [1, 6]</lang>
print(anySum(7, [6, 3]))
# -> []</lang>
9,655

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.