#C5116. Two Sum Problem

    ID: 48730 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

Given a list of integers and a target sum, determine whether there exist two distinct numbers in the list such that their sum is equal to the target.

Formally, for an array \(A\), find two different indices \(i\) and \(j\) with \(i \neq j\) such that \(A_i + A_j = \text{target}\). This problem requires you to efficiently check for a valid pair using standard input and output for data communication.

inputFormat

The input is given in three lines:

  1. The first line contains an integer \(n\), representing the number of elements in the list.
  2. The second line contains \(n\) space-separated integers.
  3. The third line contains an integer \(target\), representing the target sum.

outputFormat

Output a single line containing either True if there exists two distinct numbers in the list whose sum equals the target, or False otherwise.

## sample
4
2 7 11 15
9
True