Taken from DailyCodingProblem:
Given a list of numbers and a number
k
, return whether any two numbers from the list add up tok
.For example, given
[10, 15, 3, 7]
andk
of17
, returntrue
since10 + 7
is17
.
Solution
This is the answer I came up with: