Created
April 28, 2021 16:01
-
-
Save therealnaveenkamal/665e957a473595efe4e41157a81b2f14 to your computer and use it in GitHub Desktop.
Daily Coding Problem #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def checkFunc(k, input_nums): | |
for i in range(len(input_nums)): | |
for j in range(i+1,len(input_nums)): | |
if(input_nums[i] + input_nums[j] == k): | |
return True | |
return False | |
input_nums = list(map(int, input().split(" "))) | |
k = int(input()) | |
print(checkFunc(k, input_nums)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question: Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.