Challenge: Find Two Numbers that Add up to "k"

Given a list and a number "k", find two numbers from the list that sum to "k".

Problem Statement

In this problem, you have to implement the find_sum(lst,k) function which will take a number k as input and return two numbers that add up to k. In case there is more than one pair in the array containing numbers that add up to k, you are required to return only one such pair. If no such pair is found then return an empty list.

Input

A list and a number k.

Output

A list with two integers a and b that add up to k.

Sample Input

lst = [1,21,3,14,5,60,7,6]
k = 81

Sample Output

lst = [21,60]

For example, in this illustration, we are given 81 as the number k and when we traverse the whole list we find that 21 and 60 are the integers that add up to 81.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.