#C1833. Two Sum Problem
Two Sum Problem
Two Sum Problem
Given a list of integers and a target integer, determine whether any two distinct numbers in the list sum up exactly to the target value.
Challenge: You need to implement an efficient algorithm to check for the existence of such a pair. The answer should be True
if such a pair exists, and False
otherwise.
Note: The solution must read input from stdin and output the result to stdout.
inputFormat
The input consists of three parts provided via standard input:
- An integer
n
representing the number of elements in the list. - A line of
n
space-separated integers. - An integer representing the target sum.
outputFormat
Output a single line with True
if there exists any pair of distinct numbers in the list that sum to the target, or False
otherwise.
4
10 15 3 7
17
True