This problem was recently asked by Google.
Given a list of numbers and a number k
, return whether any two numbers from the list add up to k
.
Input:
arr: [10, 15, 3, 7]
k: 17
Output:
True (because 10 + 7 = 17)
Input:
arr: [10, 15, 3, 7]
k: 11
Output:
False (no pair summed generates 11)